Exemple #1
0
 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);
         }
     }
 }
Exemple #2
0
 public CommandHandler(IEventStore eventStore, InMemoryDomainEvents domainEvents)
 {
     DomainEvents          = domainEvents;
     EntityEventWriter     = new EntityEventWriter(eventStore);
     CommandSubscriptionId = SubscriptionId.New();
     EntityConsolidator    = new EntityConsolidator <TEntity>(eventStore, domainEvents);
 }
Exemple #3
0
 internal void InstantiateChangeUserEmailCommandHandlerSubscriptionId()
 {
     ChangeUserEmailCommandHandlerSubscriptionId = SubscriptionId.New();
 }
Exemple #4
0
 internal void InstantiateTakeUserSnapshotCommandHandlerSubscriptionId()
 {
     TakeUserSnapshotCommandHandlerSubscriptionId = SubscriptionId.New();
 }
Exemple #5
0
 internal void InstantiateCreateUserCommandHandlerSubscriptionId()
 {
     CreateUserCommandHandlerSubscriptionId = SubscriptionId.New();
 }