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.
13 lines
467 B
C#
13 lines
467 B
C#
namespace EntityFrameworkCore.Domain;
|
|
// Since C#11, you do not need to wrap in accolades anymore.
|
|
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; } = new List<Match>() { };
|
|
public List<Match> AwayMatches { get; set; } = new List<Match>() { };
|
|
}
|