Exemplo n.º 1
0
        public async Task <TResult> HandleAsync(TCommand command)
        {
            try
            {
                var transaction = await _transactionFactory.RequestTransactionAsync(_transactionType).ConfigureAwait(false);

                var result = await _decoratee.HandleAsync(command).ConfigureAwait(false);

                await _transactionFactory.CommitTransactionAsync().ConfigureAwait(false);

                return(result);
            }
            catch (Exception)
            {
                await _transactionFactory.RollbackTransactionAsync().ConfigureAwait(false);

                throw;
            }
        }