Hi,
I have two aggregates AR1 and AR2.
Suppose AR1 is Folder aggregate and AR2 is File aggregate.
There may be certain operations which may impact both aggregates e.g Delete folder command needs to delete folder as well as the files contained in it. For this AR1 will need to hold references to AR2.
What is the best practice to hold this information? Aggregate AR1 itself or Command Handler should query, query model to find out all the child file aggregates of folder aggregate and invoke Delete File Command.
In some of threads I had read its not a good practice to send a command from a command handler and Saga or Event Handlers should be used instead. But in this scenario we also have to maintain transaction i.e if Delete File fails then Delete Folder should fail too.
Can anyone share some insights on this please?
Thanks & Regards,
Prachi Mujumdar