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