0
kicks
Container-friendly domain events and disposable actions
A lot of times an operation on a single aggregate root needs to result in side effects that are outside the aggregate root boundary. There are several ways to accomplish this, such as:
- A return parameter on the method
- A collecting parameter
- Domain events
Contextual containers and disposable actions
What I need to do is allow this static method to work with a contextual, scoped piece of code. But that’s exactly what the “using” statement allows us to do – create a scoped piece of code, that executes something at the beginning (whatever creates the IDisposable) and something at the end (the Dispose method).