I\'ve just started using EF code first, so I\'m a total beginner in this topic.
I wanted to create relations between Teams and Matches:
1 match = 2 teams (ho
It's also possible to specify the ForeignKey() attribute on the navigation property:
ForeignKey()
[ForeignKey("HomeTeamID")] public virtual Team HomeTeam { get; set; } [ForeignKey("GuestTeamID")] public virtual Team GuestTeam { get; set; }
That way you don't need to add any code to the OnModelCreate method
OnModelCreate