Example #1
0
 /// <summary>
 /// Factory to create an instance of an adapter which basically integrates an event store with domain bus,
 ///  so that the events will be automatically stored and published, with idempotency support. The USP here is easy idempotency.
 ///  The instance can be registered as a singleton, depending on the implementation of <see cref="IAppendEventsToStore"/>.
 /// Use it in the command handler.
 /// </summary>
 /// <param name="bus"></param>
 /// <param name="store"></param>
 /// <returns></returns>
 public static IStoreAndPublishEvents CreateEventsStoreAndPublisher(this IDomainBus bus, IAppendEventsToStore store)
 => new EventsStoreAndPublisher(bus.GetDispatcher(), store);
 public EventsStoreAndPublisher(IDispatchMessages bus, IAppendEventsToStore appender)
 {
     _bus      = bus;
     _appender = appender;
 }