Let's say I have 3 tables in a tennis application (removed from the removal of irrelevant information):
Competitions
Id (PK)
Matches
Id (PK)
CompId (FK)
Courtassignments
CompId (PK), (FK)
CourtNumber (PK)
MatchId (FK), (unique)
To describe the above: The match consists of 2 people playing tennis against each other on the court. The competition consists of 0 in many matches.
A court order shall be submitted by the court during the competition (during one competition, 0 or 1 match may be assigned to the court). Also, one match can only be played by one court number and exists in only one competition (so that these two fields together form the primary key for the CourtAssignment table)
Thus, the MatchAssignment MatchId field will ALWAYS be unique or null.
EF- . CourtAssignment - *. 0..1.
- Visual Studio 2010 2 ( .Net 4 beta 2 EF 4 beta 2).
- 1 * 0..1. , - 2, go-live ( , , change * 0..1 :
113: Role 'CourtAssignments' 'CourtAssignments_MatchId_FK_Matches_Id'. , *.
0..1? , , . , edmx.
. , MatchId , , [CompId, CourtNumber], , . , , .
, !