Ejemplo n.º 1
0
 protected virtual void Dispose(bool disposing)
 {
     if(!isDisposed)
     {
         if (disposing)
         {
         if (_trx != null) { _trx.Dispose(); _trx = null; }
         if (_conn != null) { _conn.Dispose(); _conn = null; }
         }
     }
     // Code to dispose the unmanaged resources
     // held by the class
     _trx = null;
     _conn = null;
     isDisposed = true;
 }
Ejemplo n.º 2
0
        public void Commit()
        {
            #if (SQLDebug)
                 System.Diagnostics.Debug.Write("Commit Transaction : ");
            #endif

            if (_trx == null) { _trxCnt = 0; return; }
            if (_trxCnt == 1)_trx.Transaction.Commit();
            #if (SQLDebug)
                 System.Diagnostics.Debug.Write(_trx.GetHashCode());
            #endif

            if (_trxCnt > 0) _trxCnt--;
            if (_trxCnt < 1) _trx = null;
        }
Ejemplo n.º 3
0
 public void Rollback()
 {
     #if (SQLDebug)
          System.Diagnostics.Debug.Write("Commit Transaction : ");
     #endif
     if (_trx == null) { _trxCnt = 0; return; }
     _trx.Transaction.Rollback();
     #if (SQLDebug)
          System.Diagnostics.Debug.Write(_trx.GetHashCode());
     #endif
     _trxCnt = 0;
     _trx = null;
 }
Ejemplo n.º 4
0
        public DBTransaction BeginTransaction()
        {
            #if (SQLDebug)
                System.Diagnostics.Debug.Write("Begin Transaction : ");
            #endif

            if (_conn.State == System.Data.ConnectionState.Closed) _conn.Open();
            if (_trx == null) _trx = new DBTransaction(_conn.BeginTransaction(), this);
            _trxCnt++;
            #if (SQLDebug)
                  System.Diagnostics.Debug.WriteLine(_trx.GetHashCode());
            #endif

            return _trx;
        }