Skip to content

Association on List - Join Table #4171

Closed Answered by MaceWindu
Dutch-0 asked this question in Q&A
Discussion options

You must be logged in to vote

We support only OneToOne/OneToMany associations. You can check various examples here https://github.com/linq2db/linq2db/blob/master/Tests/Linq/Linq/AssociationTests.cs

Cardinality defined by type of association: TRecord or IEnumerable<TRecord>. You can also use other collection types, like IQueryable<T>, array, List<T>, but I personally prefer IEnumerable<T> as it doesn't insinuate additional functionality, not really supported here.

Join condition could be defined as set of key fields, custom sql or even custom sub-query (see tests for examples).

For ManyToMany association you will need to define intermediate table mapping wtih associations to both sides.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Dutch-0
Comment options

You must be logged in to vote
1 reply
@MaceWindu
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants