I am designing an application, which will store sports statistics, show them in different diagrams and do few more operations on them. Allow user to do some mock drafts etc.
I choose to build a domain first, and then create a database via code-fist approach. So I have my entities:
- Player (name, teamId, list of stats)
- Team (name, list of players)
- Stats (beginDate, endDate, playerId, <...different stats in separate columns>...........)
How should I divide them into aggregates? I know Player
is an aggregate. I know that List should be in Player
aggregate. But what about the Team
? Is the team part of Player
aggregate or separate one?
I'm confused, cause Player definitely has to have foreign key to the Team. But the Team makes totally sense without a Player (not like Stats, which without a Player doesn't make sense at all - that's why they are part of Player aggregate). I could show statistics for Teams only.
Should the Team be separate aggregate?
EDIT: This is how my domain looks like:
public class Stats
{
// Stats...
}
public class Player
{
public Team Team { get; private set; }
public List<Stats> Stats { get; private set; }
}
public class Team
{
public string Name { get; private set; }
public string FullName { get; private set; }
}