First said, this is my first experience using the Entity Framework so I apologize if this ends up being a newbie question. Everything has gone well so far; but, I run into a situation that I am not sure what the best way to handle is.
I need to create a many-to-many relationship; but, the many-to-many table contains more than just the composite key. In this case the Entity Framework does not see to recognize it as a many-to-many structure and so I don't seem to get the easy ability to get the collections without using the intervening table. Is there a better way to do this?
Simplified Example:
- A Unit can have many boards and a board could have been in many units
- When it is in a unit we need to record what slot it was in.
Tables:
Unit
UnitID(PK)
UnitName
Board
BoardID(PK)
BoardName
UnitBoard
UnitID(PK,FK1)
BoardID(PK,FK2)
Slot
When I pull this into my code using an ADO.NET Entity Data Model, I don't see an easy way to get the collection of Boards associated to a Unit from the Unit Entity or visa-versa.
Is there a better way to do this or do I just need to use the associated collection of UnitBoards then use that to build the collection of Units/Boards?
This seems I am probably not the first person to went to do something like this. Ex: I was thinking of Books and Owners wanting to also keep the related BookOwner information (like the purchase date).