예제 #1
0
 public override int ExecuteNonQuery()
 {
     if (_transaction != null)
     {
         try
         {
             _transaction.BeginCommand(this);
             return InnerCommand.ExecuteNonQuery();
         }
         finally
         {
             _transaction.EndCommand();
         }
     }
     else
     {
         try
         {
             _txnlock.OpenWriter();
             _txnlock.BeginCommand(this);
             return InnerCommand.ExecuteNonQuery();
         }
         finally
         {
             _txnlock.EndCommand();
             _txnlock.CloseWriter();
         }
     }
 }
예제 #2
0
        // disposing: true if Dispose() was called, false
        // if being finalized by the garbage collector
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Close the transaction before closing the lock
                if (InnerTransaction != null)
                {
                    InnerTransaction.Dispose();
                    InnerTransaction = null;
                }

                if (_transactionLock != null)
                {
                    _transactionLock.CloseWriter();
                }
            }

            base.Dispose(disposing);
        }