Hooking ES in to a domain model


I’ve got a domain model in which one of the classes isTest.

This class has a Run method. Within this method I’m wanting to raise a TestRunRequestedEvent.

It seems a bit messy to have my domain object rely on the EventStore connection to be able to do this. Given that Run is a part of the domain and expresses an action, is there any better way of doing this?

How have people handled these sorts of scenarios?

Any help appreciated.

Kind regards


DomainEvents.Publish(new TestRunRequested(...)) where you can push
multiple events before committing the "session" if you want to.

Alternatively you can do something similar to what SimpleCQRS does
https://github.com/gregoryyoung/m-r and push the events on the save of
the aggregate.