public void Handle(TCommand command) { lock (this) { try { ExecutingCommand = command; var domainEventSubscriptionId = SubscriptionId.New(); var sourceEvents = new List <IEvent>(); PrepareForExecuteCommand(); var monitoredEventTypes = MonitoredEventTypes(); RegisterObserverForLaunchedEvents(domainEventSubscriptionId, monitoredEventTypes, (entityPropertyChanged) => { sourceEvents.Add(entityPropertyChanged); }); ExecuteCommandInSingleThread(); WaitForVerification(TimeToWaitToLaunchedEventsInSeconds); SaveLaunchedEventsDueToCommandExecution(sourceEvents); UnregisterObserverForLaunchedEvent(domainEventSubscriptionId, monitoredEventTypes); Complete(); ExecutingCommand = default(TCommand); } catch (Exception e) { Fail(e); } } }
public CommandHandler(IEventStore eventStore, InMemoryDomainEvents domainEvents) { DomainEvents = domainEvents; EntityEventWriter = new EntityEventWriter(eventStore); CommandSubscriptionId = SubscriptionId.New(); EntityConsolidator = new EntityConsolidator <TEntity>(eventStore, domainEvents); }
internal void InstantiateChangeUserEmailCommandHandlerSubscriptionId() { ChangeUserEmailCommandHandlerSubscriptionId = SubscriptionId.New(); }
internal void InstantiateTakeUserSnapshotCommandHandlerSubscriptionId() { TakeUserSnapshotCommandHandlerSubscriptionId = SubscriptionId.New(); }
internal void InstantiateCreateUserCommandHandlerSubscriptionId() { CreateUserCommandHandlerSubscriptionId = SubscriptionId.New(); }