예제 #1
0
        /// <summary>
        /// Rollback active transaction
        /// </summary>
        private static void RolebackTransaction()
        {
            try {
                ActiveTransaction.Rollback();

                if (log.IsWarnEnabled)
                {
                    log.Warn("활성화된 Transaction을 Rollback 했습니다.");
                }
            }
            catch (Exception ex) {
                if (log.IsErrorEnabled)
                {
                    log.Error("Transaction Rollback에 실패했습니다.");
                    log.Error(ex);
                }
            }
            finally {
                if (ActiveTransaction != null)
                {
                    ActiveTransaction.Dispose();
                    ActiveTransaction = null;
                }
                TransactionCount = 0;
            }
        }
예제 #2
0
 /// <summary>
 /// Rollbacks the transaction.
 /// </summary>
 private static void RollbackTransaction()
 {
     ActiveTransaction.Rollback();
     ActiveTransaction.Dispose();
     ActiveTransaction  = null;
     TransactionCounter = 0;
 }
예제 #3
0
 /// <summary>
 /// Commits the transaction.
 /// </summary>
 private static void CommitTransaction()
 {
     TransactionCounter--;
     if (TransactionCounter == 0 && ActiveTransaction != null)
     {
         ActiveTransaction.Commit();
         ActiveTransaction.Dispose();
         ActiveTransaction = null;
     }
 }
예제 #4
0
 /// <summary>
 /// Rollbacks the current transaction.
 /// </summary>
 public virtual void Rollback()
 {
     EnsureTransactionIsActive();
     try {
         ActiveTransaction.Rollback();
     }
     finally {
         ActiveTransaction.Dispose();
         ClearActiveTransaction();
     }
 }
예제 #5
0
 /// <summary>
 /// Commits the current transaction.
 /// </summary>
 public virtual void Commit()
 {
     EnsureTransactionIsActive();
     try {
         ActiveTransaction.Commit();
     }
     finally {
         ActiveTransaction.Dispose();
         ClearActiveTransaction();
     }
 }
예제 #6
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             ActiveConnection.Dispose();
             ActiveTransaction?.Dispose();
         }
     }
     _disposed = true;
 }
예제 #7
0
 /// <inheritdoc/>
 public void Dispose()
 {
     if (isDisposed)
     {
         return;
     }
     isDisposed = true;
     if (ActiveTransaction != null)
     {
         ActiveTransaction.Dispose();
         ClearActiveTransaction();
     }
     UnderlyingConnection.Dispose();
 }
예제 #8
0
        /// <summary>
        /// Dispose active transaction
        /// </summary>
        private static void DisposeTransaction()
        {
            if (TransactionCount <= 0)
            {
                if (IsDebugEnabled)
                {
                    log.Debug("활성 Transaction을 Dispose 합니다..");
                }

                if (ActiveTransaction != null)
                {
                    ActiveTransaction.Dispose();
                }
                ActiveTransaction = null;
            }
        }
예제 #9
0
        /// <summary>
        /// Commit transaction
        /// </summary>
        private static void CommitTransaction()
        {
            TransactionCount--;

            if (TransactionCount == 0 && ActiveTransaction != null)
            {
                ActiveTransaction.Commit();
                ActiveTransaction.Dispose();
                ActiveTransaction = null;

                if (log.IsInfoEnabled)
                {
                    log.Info("활성화된 Transaction을 Commit하고 Dispose했습니다.");
                }
            }
        }
예제 #10
0
        /// <summary>
        /// 현재 활성화된 Transaction이 있다면, Commit을 수행한다.
        /// </summary>
        /// <exception cref="InvalidOperationException">Current Thread Context에 활성화된 Transaction이 없을 때</exception>
        public virtual void Commit()
        {
            if (IsActiveTransaction == false)
            {
                if (IsDebugEnabled)
                {
                    log.Debug("활성화된 Transaction이 없으므로 반환합니다.");
                }

                return;
            }

            if (IsActiveTransaction)
            {
                try {
                    ActiveTransaction.Commit();

                    if (log.IsInfoEnabled)
                    {
                        log.Info("Transaction을 Commit 했습니다!!!");
                    }
                }
                catch (Exception ex) {
                    if (log.IsErrorEnabled)
                    {
                        log.ErrorException("Transaction Commit 작업이 실패했습니다.", ex);
                    }

                    throw;
                }
                finally {
                    if (IsActiveTransaction)
                    {
                        ActiveTransaction.Dispose();
                        ActiveTransaction = null;
                    }
                }
            }
        }
예제 #11
0
        /// <summary>
        /// 현재 활성화된 Transaction이 있다면, Rollback을 수행한다.
        /// </summary>
        public virtual void Rollback()
        {
            // Guard.Assert(ActiveTransaction != null, "Active transaction is null.");

            if (IsActiveTransaction == false)
            {
                if (IsDebugEnabled)
                {
                    log.Debug("ActiveTransaction이 없습니다. Rollback을 수행하지 않습니다.");
                }

                return;
            }

            try {
                ActiveTransaction.Rollback();

                if (log.IsInfoEnabled)
                {
                    log.Info("Transaction을 Rollback 했습니다.");
                }
            }
            catch (Exception ex) {
                if (log.IsErrorEnabled)
                {
                    log.ErrorException("Transaction Rollback 작업이 실패했습니다.", ex);
                }
                throw;
            }
            finally {
                if (IsActiveTransaction)
                {
                    ActiveTransaction.Dispose();
                    ActiveTransaction = null;
                }
            }
        }