/// <summary> /// Cancels the transaction. /// </summary> public void CancelTransaction() { if (TransactionStack.Count > 0) { TransactionStack.Pop(); } }
internal void CommitTransaction() { if (TransactionStack.Count == 0) { throw new InvalidOperationException("ActionManager.CommitTransaction was called when there is no open transaction (TransactionStack is empty). Please examine the stack trace of this exception to find code which called CommitTransaction one time too many. Normally you don't call OpenTransaction and CommitTransaction directly, but use using(var t = Transaction.Create(Root)) instead."); } ITransaction transaction = TransactionStack.Pop(); if (transaction.AccumulatingAction.Count > 0) { RecordAction(transaction.AccumulatingAction); } }
} // OpenTransaction public static void CommitTransaction() { if (TransactionStack.Count == 0) { throw new InvalidOperationException( "ActionManager.CommitTransaction was called" + " when there is no open transaction (TransactionStack is empty)." + " Please examine the stack trace of this exception to find code" + " which called CommitTransaction one time too many." + " Normally you don't call OpenTransaction and CommitTransaction directly," + " but use using(var t = Transaction.Create(Root)) instead."); } Transaction committing = TransactionStack.Pop(); if (committing.HasActions()) RecordAction(committing); } // CommitTransaction