Пример #1
0
        private bool Execute(ReceiveMoneyCommand command)
        {
            var moneyReceived = new MoneyReceivedEvent(command.Transaction);

            Emit(moneyReceived);
            return(true);
        }
Пример #2
0
        public bool Handle(IDomainEvent <Account, AccountId, MoneySentEvent> domainEvent)
        {
            var isNewSpec = new AggregateIsNewSpecification();

            if (isNewSpec.IsSatisfiedBy(this))
            {
                var command = new ReceiveMoneyCommand(
                    domainEvent.AggregateEvent.Transaction.Receiver,
                    domainEvent.AggregateEvent.Transaction);

                AccountAggregateManager.Tell(command);

                Emit(new MoneyTransferStartedEvent(domainEvent.AggregateEvent.Transaction));
            }

            return(true);
        }