/// <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; } }
/// <summary> /// Rollbacks the transaction. /// </summary> private static void RollbackTransaction() { ActiveTransaction.Rollback(); ActiveTransaction.Dispose(); ActiveTransaction = null; TransactionCounter = 0; }
/// <summary> /// Commits the transaction. /// </summary> private static void CommitTransaction() { TransactionCounter--; if (TransactionCounter == 0 && ActiveTransaction != null) { ActiveTransaction.Commit(); ActiveTransaction.Dispose(); ActiveTransaction = null; } }
/// <summary> /// Rollbacks the current transaction. /// </summary> public virtual void Rollback() { EnsureTransactionIsActive(); try { ActiveTransaction.Rollback(); } finally { ActiveTransaction.Dispose(); ClearActiveTransaction(); } }
/// <summary> /// Commits the current transaction. /// </summary> public virtual void Commit() { EnsureTransactionIsActive(); try { ActiveTransaction.Commit(); } finally { ActiveTransaction.Dispose(); ClearActiveTransaction(); } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { ActiveConnection.Dispose(); ActiveTransaction?.Dispose(); } } _disposed = true; }
/// <inheritdoc/> public void Dispose() { if (isDisposed) { return; } isDisposed = true; if (ActiveTransaction != null) { ActiveTransaction.Dispose(); ClearActiveTransaction(); } UnderlyingConnection.Dispose(); }
/// <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; } }
/// <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했습니다."); } } }
/// <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; } } } }
/// <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; } } }