Best practice question on Entity Framework.
I have a Cases table and a Users table and I want to join them in a many to many relationship. However, I'd like the join itself to store information about that relationship with a "UserType" field.
Easy to do in SQL - two main data tables and a third which links the two with foreign keys and includes an extra column for UserType.
create table #user ( UserId int, Info nvarchar(4000) )
create table #case ( CaseId int, Info nvarchar(4000) )
create table #jointable ( UserId int, CaseId int, UserType nvarchar(99))
What's confusing me is EF's capability to define join tables itself, taking it out of the hands of the developer. In this instance, do I need to define all three as EF classes, or is there a way to build this where I only define two classes, Case and User, and let EF handle the join for me while still getting my UserType?
I'm using "code first" EF, not that that should make much difference to the solution.
Cheers, Matt