internal void ExecuteBatch(IUpdateBatch batch)
        {
            try
            {
                batch.ApplyChanges(this);
                _retryPolicy.Execute(_connection.Commit);
            }
            catch (Exception)
            {
                try
                {
                    _retryPolicy.Execute(_connection.Rollback);
                }
                catch (RollbackException e)
                {
                    if (e.InnerException != null)
                    {
                        Logger.LogFailure(new NpgsqlCommand(), e.InnerException);
                    }
                }
                catch (Exception e)
                {
                    Logger.LogFailure(new NpgsqlCommand(), e);
                }

                tryApplyTombstoneBatch();

                throw;
            }
        }
Ejemplo n.º 2
0
        internal void ExecuteBatch(IUpdateBatch batch)
        {
            try
            {
                batch.ApplyChanges(this);
                Database.Commit();
            }
            catch (Exception)
            {
                Database.Rollback();

                if (Options.EventGraph.TryCreateTombstoneBatch(this, out var tombstoneBatch))
                {
                    try
                    {
                        tombstoneBatch.ApplyChanges(this);
                    }
                    catch (Exception)
                    {
                        // Failures are logged within the ManagedConnection
                    }
                }

                throw;
            }
        }
        internal void ExecuteBatch(IUpdateBatch batch)
        {
            try
            {
                batch.ApplyChanges(this);
                _retryPolicy.Execute(_connection.Commit);
            }
            catch (Exception)
            {
                try
                {
                    _retryPolicy.Execute(_connection.Rollback);
                }
                catch (RollbackException e)
                {
                    if (e.InnerException != null)
                    {
                        Logger.LogFailure(new NpgsqlCommand(), e.InnerException);
                    }
                }
                catch (Exception e)
                {
                    Logger.LogFailure(new NpgsqlCommand(), e);
                }

                if (Options.EventGraph.TryCreateTombstoneBatch(this, out var tombstoneBatch))
                {
                    try
                    {
                        tombstoneBatch.ApplyChanges(this);
                        _retryPolicy.Execute(_connection.Commit);
                    }
                    catch (Exception e)
                    {
                        Logger.LogFailure(new NpgsqlCommand(), e);
                    }
                }

                throw;
            }
        }