Пример #1
0
        private void ExecuteCommand(ICommand command)
        {
            using (ICommandBus commandBus = ServiceLocator.Instance.GetService <ICommandBus>())
            {
                commandBus.Publish(command);

                commandBus.Commit();
            }
        }
Пример #2
0
        public void Buses_CommandBus_ChangeEmailFor1005TimesTest()
        {
            SourcedCustomer customer = new SourcedCustomer();

            using (IDomainRepository domainRepository = application.ObjectContainer.GetService <IDomainRepository>())
            {
                domainRepository.Save(customer);
                domainRepository.Commit();
            }

            ChangeEmailCommand cmd = new ChangeEmailCommand(customer.ID, "*****@*****.**");

            using (ICommandBus bus = application.ObjectContainer.GetService <ICommandBus>())
            {
                bus.Publish(cmd);
                bus.Commit();
            }
        }
 private void CommitCommand(ICommand command)
 {
     try
     {
         using (ICommandBus commandBus = AppRuntime
                                         .Instance
                                         .CurrentApplication
                                         .ObjectContainer
                                         .GetService <ICommandBus>())
         {
             commandBus.Publish(command);
             commandBus.Commit();
         }
     }
     catch (Exception ex)
     {
         WCFServiceFault sf = new WCFServiceFault
         {
             Message    = ex.Message,
             StackTrace = ex.StackTrace
         };
         throw new FaultException <WCFServiceFault>(sf, sf.Message);
     }
 }