コード例 #1
0
 private bool DeregisterOngoing(IPipelineTransaction transaction)
 {
     if (!OngoingTransactions.Remove(transaction))
     {
         throw new ArgumentException("Transaction is not registered.");
     }
     return(OngoingTransactions.Count <= 0);
 }
コード例 #2
0
        /// <summary>
        /// Cancels the specified transaction.
        /// </summary>
        /// <param name="transaction">The transaction to cancel.</param>
        public void Cancel(DeferredPipelineTransaction transaction)
        {
            if (transaction is null)
            {
                throw new ArgumentNullException(nameof(transaction));
            }

            lock (this)
            {
                OngoingTransactions.Remove(transaction);
                if (DeregisterOngoing(transaction))
                {
                    CommitTransaction(AggregatedTransaction.Values);
                }
            }
        }