I am designing a CQRS application using DDD, and am wondering how to implement the following scenario:
Participant
aggregate can be referenced by multiple ParticipantEntry
aggregatesAddParticipantInfoCommand
is issued to the Command side, which contains all info of the Participant
and one ParticipantEntry
(similar to an Order
and one OrderLineItem
)Where should the logic be implemented that checks whether the Participant already exists and if it doesn't exist, creates the Participant?
Participant
, and if it doesn't find it, issues an AddParticipantCommand
and afterwards an AddParticipantEntry
command containing the Participant ID
?You don't necessarily need sagas in order to deal with this situation. Take a look at my blog post on why not to create aggregate roots, and what to do instead: