Пример #1
0
 public void Rollback()
 {
     if (_finished)
     {
         throw new Exception("This transaction is finished");
     }
     if (!_rolledBack)
     {
         if (_ownsTransaction)
         {
             ConScope.RollbackTransaction();
         }
         _rolledBack = true;
         _finished   = true;
     }
 }
Пример #2
0
 public void Commit()
 {
     if (_finished)
     {
         throw new Exception("This transaction is finished");
     }
     if (!_commited)
     {
         if (_ownsTransaction)
         {
             ConScope.CommitTransaction();
         }
         _commited = true;
         _finished = true;
     }
 }
Пример #3
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }
            _disposed = true;

            if (_ownsTransaction)
            {
                if (!_finished)
                {
                    // If we disposed transaction without commit/rollback, do an implicit rollback.
                    ConScope.RollbackTransaction();
                }
            }

            ConScope.UnrefTransaction();
        }
Пример #4
0
 private async Task Init()
 {
     _ownsTransaction = await ConScope.RefTransaction();
 }