Ejemplo n.º 1
0
        public async Task OnDomainEventAsync(IDomainEventingContext context, DepositTransactionReadiedDomainEvent @event, CancellationToken token = default)
        {
            var sql = $"UPDATE `{Tables.AccountInTransactions}` SET `Status`=@Status WHERE `Id`=@TransactionId;";

            var po = new
            {
                TransactionId = @event.AggregateRootId.Id,
                Status        = @event.Status.ToString()
            };

            await _db.ExecuteAsync(sql, po, token);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 3. 从存款交易聚合根,收到存款交易已准备就绪的领域事件,向银行账户聚合跟提交存款交易。
        /// </summary>
        /// <param name="context">事件处理上下文</param>
        /// <param name="event">存款交易已准备就绪的领域事件</param>
        public void OnDomainEvent(IDomainEventingContext context, DepositTransactionReadiedDomainEvent @event)
        {
            var command = new SubmitDepositTransactionDomainCommand(@event.AggregateRootId, @event.AccountId);

            context.PublishDomainCommand(command);
        }