Add one to one relationship between Coach and Team.
A Coach is parent, Team is child. A Coach can exist on his own, without a Team, but a Team cannot play without a Coach.
This commit is contained in:
parent
1813bf6362
commit
b0e653ab0d
@ -3,6 +3,6 @@
|
||||
public class Coach : BaseDomainModel
|
||||
{
|
||||
public string Name { get; set; } // Strings are automatically become VARCHAR database types.
|
||||
public int? TeamId { get; set; }
|
||||
public Team? Team { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,8 @@ public class Team : BaseDomainModel
|
||||
public string? Name { get; set; }
|
||||
public League? League { get; set; }
|
||||
public int? LeagueId { get; set; }
|
||||
public Coach Coach { get; set; }
|
||||
public int CoachId { get; set; }
|
||||
public List<Match> HomeMatches { get; set; }
|
||||
public List<Match> AwayMatches { get; set; }
|
||||
public List<Match> HomeMatches { get; set; } = new List<Match>() { };
|
||||
public List<Match> AwayMatches { get; set; } = new List<Match>() { };
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user