0

I wanted to publish a domain event after a transaction completes. So I have followed this article here: http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ and also had a look at this SO post: Should I Pass a repository to a Domain Method that fires an Event

Makes sense... but I am confused as to how to resolve the Interface collection to the concrete types. For example in the collection of IEvent there maybe 2-3 different types of events. How do I figure out which event was added to fire the correct handler?

Community
  • 1
  • 1
Cool Breeze
  • 1,289
  • 11
  • 34

1 Answers1

1

I found the answer in the comment of the following post: http://lostechies.com/jimmybogard/2014/05/13/a-better-domain-events-pattern/ i.e.

DomainEvents.Raise((dynamic) event)

Cool Breeze
  • 1,289
  • 11
  • 34
  • I think the static class is perfectly fine. DomainEvents fires synchronously, an all-events-subscriber appends every event within the same transaction scope as the aggregate root operation to an event store. This ensure that events gets written to disk only if the whole transaction succeeds. Then, an asynchronous mechanisms forwards those to a messaging infrastructure. – plalx Dec 02 '14 at 14:14