Npgsql.NpgsqlTransactionCallbacks.PrepareTransaction C# (CSharp) Method

PrepareTransaction() public method

public PrepareTransaction ( ) : void
return void
        public void PrepareTransaction()
        {
            if (!_prepared)
            {
                NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "PrepareTransaction");
                NpgsqlConnection connection = GetConnection();
                NpgsqlCommand.ExecuteBlind(connection.Connector, string.Format("PREPARE TRANSACTION '{0}'", _txName));
                _prepared = true;
            }
        }

Usage Example

示例#1
0
 /// <summary>
 /// Used when a connection is closed
 /// </summary>
 public void Prepare()
 {
     NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Prepare");
     if (_inTransaction)
     {
         // may not be null if Promote or Enlist is called first
         if (_callbacks == null)
         {
             _callbacks = new NpgsqlTransactionCallbacks(_connection);
         }
         _callbacks.PrepareTransaction();
         if (_npgsqlTx != null)
         {
             // cancel the NpgsqlTransaction since this will
             // be handled by a two phase commit.
             _npgsqlTx.Cancel();
             _npgsqlTx.Dispose();
             _npgsqlTx = null;
         }
     }
 }
All Usage Examples Of Npgsql.NpgsqlTransactionCallbacks::PrepareTransaction