Beispiel #1
0
        /// <summary>
        /// Close current transaction, this function is private because is used inside a DisposableAction.
        /// We need to check if are inside an exception handler to doom the transaction, then we need to
        /// remove the global transaction from the context and committ it.
        /// </summary>
        private static void CloseCurrentTransaction()
        {
            Verify.That(IsInTransaction, "Cannot doom the transaction because there is not an active transaction");
            if (Utils.ExceptionUtils.IsInExceptionHandler())
            {
                CurrentTransaction.Doom();
            }
            Boolean IsDoomed = CurrentTransaction.IsDoomed;

            OnTransactionClosing(IsDoomed);
            Transaction currentTransaction = CurrentTransaction;

            CurrentTransactionList.RemoveAt(CurrentTransactionList.Count - 1);
            if (CurrentTransactionList.Count == 0)
            {
                CurrentContext.ReleaseData(TransactionScopeKey);
            }
            currentTransaction.Complete();
            OnTransactionClosed(IsDoomed);
        }
Beispiel #2
0
 public static void DoomCurrentTransaction()
 {
     Verify.That(IsInTransaction, "Cannot doom the transaction because there is not an active transaction");
     CurrentTransaction.Doom();
 }