Howto: Use single transaction to span update of multiple aggregates

351 views Asked by At

In our application we are using Jonathan Oliver's EventStore and CommonDomain. The database we use to store our events is either SQL Server or Oracle.

For a specific use case we have the requirement to update several aggregates through one single command. I realize that (in CQRS) ideally one command should only update one aggregate but in our case it is a specific requirement to update multiple instances at once.

Is there an easy way (without using two phase commit) to make this operation atomic and if yes how would that be possible?

Edit: The question is specific to the use of the EventStore framework (and maybe the repository of the CommonDomain framework). This is not a general question about transaction handling or Unit Of Work pattern (of which I am well aware)

1

There are 1 answers

0
John Liu On

You may try Unit of work. it will help you to make changes atomic. Here is a link from MSDN for how to implement it with Repository and EF