public DomainCommandExecutor(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus eventBus) { if (eventBus == null) throw new ArgumentNullException("eventBus"); if (registration == null) throw new ArgumentNullException("registration"); if (scope == null) throw new ArgumentNullException("scope"); this.scope = scope; this.registration = registration; this.eventBus = eventBus; }
public DomainCommandExecutor(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus eventBus) { if (eventBus == null) { throw new ArgumentNullException("eventBus"); } if (registration == null) { throw new ArgumentNullException("registration"); } if (scope == null) { throw new ArgumentNullException("scope"); } this.scope = scope; this.registration = registration; this.eventBus = eventBus; }
private void ProcessWorkItem(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus bus, IReadModelWorkItem workItem) { var eventScope = this.context.BeginUnitOfWork(); using (eventScope) { var events = eventScope.GetRegisteredObject <IEventStore>().GetEventsAfterVersion(workItem.Identity, workItem.FromVersion - 1).ToList(); var builders = registration.DelayedReadModels(scope); foreach (var builder in builders) { if (workItem.FromVersion == 0) { builder.DeleteForAggregate(workItem.Identity); } // we need to get the events from the event store var builderEvents = builder.Process(events); foreach (var evt in builderEvents) { bus.Publish(evt); } } } }
private void ProcessWorkItem(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus bus, IReadModelWorkItem workItem) { var eventScope = this.context.BeginUnitOfWork(); using (eventScope) { var events = eventScope.GetRegisteredObject<IEventStore>().GetEventsAfterVersion(workItem.Identity, workItem.FromVersion - 1).ToList(); var builders = registration.DelayedReadModels(scope); foreach (var builder in builders) { if (workItem.FromVersion == 0) { builder.DeleteForAggregate(workItem.Identity); } // we need to get the events from the event store var builderEvents = builder.Process(events); foreach (var evt in builderEvents) { bus.Publish(evt); } } } }
public void Register(IAggregateRegistration registration) { this.registrations.Add(registration); }