how to handle two separate aggregate roots holding reference to same data?
In a domain model that models sports events how should this scenario be
handled, especially in the context of using a no sql document database to
hold the data.
The main entities in the system are Season, Tournament Group, Tournament,
Tournament-Stage, Match, Player.
Season - A Season has a start date, end date, an ordered collection of
Player and a collection of Tournament.
Tournament Group - A tournament group contains a collection of tournament,
each tournament can only belong to one tournament group. I am unsure if
this should actually be an entity.
Tournament - A Tournament has a start date, end date, an ordered
collection of Player and an ordered collection of Tournament-Stage.
Tournament-Stage - A Tournament-Stage has an ordered collection of Match.
Not sure if this should be an entity as its just a way to group matches
with in a Tournament.
Match - A Match contains a collection of Player.
This is where it gets confusing for me be because I would say so far that
the aggregate root is the Season but there will be I don't know where the
Player fits into this model and I'm probably not dealing with tournament
group properly either.
Statistics need to be generated to for a Season, Tournament Group and
Player e.g. Who scored the most in a Season, Who scored the most in a
Tournament Group and for a Player which Tournament, Season or Tournament
Group he scored most in.
To get this data I would have thought that the Player entity would have to
hold references to Tournament and Match but these references are also help
by Season. Is this acceptable and what is the best strategy for updating
the data in one aggregate root if it changes in another ?
No comments:
Post a Comment