scotru wrote:
I'm looking for advice on how best to handle the situation described here:
http://stackoverflow.com/questions/7050404/create-code-first-many-to-many-with-additional-fields-in-association-table
Say, I have a many-to-many relation from A to C thru association table B (which also has additional fields). Ideally, I'd like to map both B and C (joined) to one entity with and many to one relation to A (and vice-versa, ie. to have another entity mapped to A and B with a many to one relation to C).
Is this possible with LLBLGen? If not, could I get best practices or suggestions for handing this type of scenario?
You can't map an entity to a joined set (so it's not possible to map an entity to the join of B and C). What you describe is supported though. It's called an 'Objectified Relationship' in relationship modeling and you simply have 3 entities: A, B and C. A and C have a m:n relationship, B has a m:1 relationship with A and a m:1 relationship with C. these 2 m:1 relationships are the basis for the m:n relationship between A and C. If you're familiar with the old Northwind database, what you describe is the Order - OrderDetails - Product entity set-> OrderDetails has a m:1 relationship with Order and a m:1 relationship with Product. This gives a m:n relationship between Order and Product over these 2 relationships.
Our runtime supports this setup as well.