CQRS variant of DDDSample.Net
The following image shows that in CQRS variant there are only two (co,pared to there in vanilla version) aggregates present: Cargo and Location.
contains logic responsible for manipulating Cargo objects from both administrative and customer's point of view. Note that
object describing current state of cargo delivery was removed from the aggregate. It's is, however, present in the codebase but only as a transient object which is published through
pattern immediately after creation. Handling event entities have been attached to Cargo aggregate and redundant Handling aggregate was removed. It's sole purpose was
to allow asynchronous handling event processing. This requirement is fulfilled by CQRS design itself.
is part of supporting subdomain which models location concepts such as
There are only three entities in CQRS variant of DDDSample.Net:
entity is the main one.
is an entity which represents a place where cargoes being are handled, for example a port. Locations also have strong identity concept--they are identified by established
represents simple cargo handling activity. It has been moved from it's own Handling aggregate to the Cargo aggregate.
In addition to domain model, CQRS variant of DDDSample.Net contains also a reporting model
. This is a view of domain from querying and reporting perspective. It could be described as a
persistent view model
: a data store which can be directly bound to search and details controls of user interface. The following picture shows simplicity of reporting model in DDDSample.Net:
It contains only two objects: Cargo
. The former represents persistent properties of a cargo, such as route specification and itinerary. The latter contains the temporary state calculated after processing every handling event. There is a collection of
s associated with each
and each Cargo
instance points to a most recent one as its current state.