RollbackAsync() публичный Метод

public RollbackAsync ( CancellationToken token ) : Task
token System.Threading.CancellationToken
Результат Task
Пример #1
0
        public async Task RollbackAsync(CancellationToken token)
        {
            if (_connection == null)
            {
                return;
            }
            if (_mode == CommandRunnerMode.External)
            {
                return;
            }

            try
            {
                await _retryPolicy.ExecuteAsync(async() => await _connection.RollbackAsync(token).ConfigureAwait(false), token);
            }
            catch (RollbackException e)
            {
                if (e.InnerException != null)
                {
                    Logger.LogFailure(new NpgsqlCommand(), e.InnerException);
                }
            }
            catch (Exception e)
            {
                Logger.LogFailure(new NpgsqlCommand(), e);
            }
            finally
            {
                _connection.Dispose();
                _connection = null;
            }
        }
Пример #2
0
        public async Task RollbackAsync(CancellationToken token)
        {
            if (_connection == null)
            {
                return;
            }

            try
            {
                await _connection.RollbackAsync(token).ConfigureAwait(false);
            }
            catch (RollbackException e)
            {
                if (e.InnerException != null)
                {
                    Logger.LogFailure(new NpgsqlCommand(), e.InnerException);
                }
            }
            catch (Exception e)
            {
                Logger.LogFailure(new NpgsqlCommand(), e);
            }
            finally
            {
                _connection.Dispose();
                _connection = null;
            }
        }