Let's say that I have two entities, Team and Match. In every Match, there are two teams, the HomeTeam and the AwayTeam. A Team can have many matches, but HomeTeam and AwayTeam can only have one team each. Sometimes Team is a HomeTeam, and sometimes the same Team is an AwayTeam. I have provided just the basics for each of the classes:
public class Team
{
public int TeamId { get; set; }
public string Name { get; set; }
}
public class Match
{
public int MatchId { get; set; }
public int HomeTeamId { get; set; }
public int AwayTeamId { get; set; }
}
How can I map this? I tried (with setting ICollection Matches and tried to map it, but I got that HomeTeam and AwayTeam can't have the same inverse relationship (something like that).
Thanks.