/// <summary> /// Executes all unit-of-work events that have been applied to the given aggregate root instances, then commits the unit of work. /// After a succesfull commit all other domain events are executed. /// </summary> /// <param name="aggregateWithFirstProcessedEvents">The changed aggregate root instance whose domain events will be executed first.</param> /// <param name="aggregateWithSecondProcessedEvents">The changed aggregate root instance whose domain events will be executed second.</param> public void ApplyChanges(TAggregateRoot1 aggregateWithFirstProcessedEvents, TAggregateRoot2 aggregateWithSecondProcessedEvents) { if (aggregateWithFirstProcessedEvents == null) { throw new ArgumentNullException("aggregateWithFirstProcessedEvents"); } if (aggregateWithSecondProcessedEvents == null) { throw new ArgumentNullException("aggregateWithSecondProcessedEvents"); } unitOfWorkDomainEventBroker.PublishEvents(aggregateWithFirstProcessedEvents.GetAppliedEvents()); unitOfWorkDomainEventBroker.PublishEvents(aggregateWithSecondProcessedEvents.GetAppliedEvents()); unitOfWork.SaveChanges(); immediateEventBroker.PublishEvents(aggregateWithFirstProcessedEvents.GetAppliedEvents()); immediateEventBroker.PublishEvents(aggregateWithSecondProcessedEvents.GetAppliedEvents()); }
public void EventsListCannotBeNull() { sut.PublishEvents(null); }