sql - Junction Tables: Changing many-to-many to one-to-many in Entity Framework model -
i've got set of tables below:
positionshiftpattern
positionshiftpatternid
positionidemployeepositionshiftpattern
employeepositionshiftpatternid
employeepositionidtemplateshiftpattern
templateshiftpatternidweek
weekidpositionshiftpatternjunction
positionshiftpatternid
weekidemployeepositionshiftpatternjunction
employeepositionshiftpatternid
weekidtemplateshiftpatternjunction
templateshiftpatternid
weekid
so positionshiftpattern, employeepositionshiftpattern , templateshiftpattern each have junction week, one-to-many relationships inbetween.
obviously ef map relationships between positionshiftpattern, employeepositionshiftpattern , templateshiftpattern , week many-to-many , create navigation properties each table directly week.
is possible change many-to-many relationships one-to-many relationships (e.g. each week should map single shiftpattern)? i'm trying achieve mutual exclusion (see diagram below) , want avoid adding positionshiftpatternid, employeepositionshiftpatternid , templateshiftpatternid week. should looking @ way of achieving mutual exclusion?
thanks
no not possible. relation must same in database. if create one-to-many relation considered new 1 , have add ids week. when looking @ model doesn't make sense introduce such relation. @ moment shift can related many weeks , week can have many shifts. if introduce one-to-many mean each week instance can have 1 shift.
Comments
Post a Comment