public async Task OnDomainEventAsync(IDomainEventingContext context, WithdrawTransactionReadiedDomainEvent @event, CancellationToken token = default) { var sql = $"UPDATE `{Tables.AccountOutTransactions}` SET `Status`=@Status WHERE `Id`=@TransactionId;"; var po = new { TransactionId = @event.AggregateRootId.Id, Status = @event.Status.ToString() }; await _db.ExecuteAsync(sql, po, token); }
/// <summary> /// 3.1 从取款交易聚合根,收到取款交易已准备就绪的领域事件,向银行账户聚合更提交交易。 /// </summary> /// <param name="context">事件处理上下文</param> /// <param name="event"></param> public void OnDomainEvent(IDomainEventingContext context, WithdrawTransactionReadiedDomainEvent @event) { var command = new SubmitWithdrawTransactionDomainCommand(@event.AggregateRootId, @event.AccountId); context.PublishDomainCommand(command); }