public override AddOrganizationCommand Handle(AddOrganizationCommand addOrganizationCommand) { Logger.Info("EFAddOrganizationCommand handles command"); Organization pm = _domainFactory.CreateOrganizationDomainObject(addOrganizationCommand); //Save in the local repository _repository.Insert(pm); //Assign Id to the command addOrganizationCommand.OrganizationId = pm.Id; //Publishes event to others subscribers _commandProcessor.Publish(new OrganizationAddedEvent()); return(base.Handle(addOrganizationCommand)); }
public override AddOrganizationCommand Handle(AddOrganizationCommand addOrganizationCommand) { Logger.Info("Normal AddOrganizationCommand handles command"); using (TransactionScope scope = new TransactionScope()) { Organization pm = _domainFactory.CreateOrganizationDomainObject(addOrganizationCommand); //Save in the local repository _repository.Insert(pm); //Assign Id to the command addOrganizationCommand.OrganizationId = pm.Id; scope.Complete(); } //Publishes event synchronously to others subscribers _commandProcessor.Publish(new OrganizationAddedEvent()); return(base.Handle(addOrganizationCommand)); }