Reputation: 1150
I have a question regarding associations in MS Entity Framework 4: Is it possible to have typed many-to-many associations?
For example, imagine a set of people and a set of projects. What I would like to model now is the peoples association to the different projects, typed by the role they play in this project.
Is this possible with EF4, or do I have to model it by hand?
Upvotes: 0
Views: 74
Reputation: 364409
You must model it by hand. There can be some workaround with inheritance but I don't expect that your person always plays the same role in all projects so it would probably not work. Another way is using multiple many-to-many associations so that each role has its own association.
By model it by hand I meant exposing junction table as separate entity wich will include reference to person, project and role. This will happen automatically if you have it defined this way in database.
Upvotes: 1