Exemplo n.º 1
0
        public Task <T> ExecuteAsync <T>(IAsyncCommand <T> command, CancellationToken cancellationToken = default)
        {
            if (command.RequiresTransaction && _transaction == null)
            {
                throw new Exception($"The command {command.GetType()} requires a transaction");
            }

            return(Retry.DoAsync(() => command.ExecuteAsync(_connection, _transaction, cancellationToken), _retryOptions));
        }
Exemplo n.º 2
0
 public Task <T> QueryAsync <T>(IAsyncQuery <T> query, CancellationToken cancellationToken = default)
 => Retry.DoAsync(() => query.ExecuteAsync(_connection, _transaction, cancellationToken), _retryOptions);