コード例 #1
0
        internal static void Participate(ITransactionParticipant participant)
        {
            if (!IsActive)
            {
                return;
            }

            TransactionQueue queue = ContextHandler.GetTransactionQueue();

            if (queue == null)
            {
                queue = new TransactionQueue();
                ContextHandler.SetTransactionQueue(queue);
            }
            queue.Add(participant);
        }
コード例 #2
0
        /// <summary>
        /// Rollbacks the current transaction.
        /// </summary>
        public static void Rollback()
        {
            if (_notSupported)
            {
                return;
            }

            ITransactionProvider tran = ContextHandler.GetTransaction();

            if (tran == null) // Means: !IsActive (Transaction is not Active)
            {
                throw new InvalidOperationException("Transaction is not active");
            }

            try
            {
                tran.Rollback();

                var queue = ContextHandler.GetTransactionQueue();
                if (queue != null)
                {
                    queue.Rollback();
                }

                OnRollbackTransaction(tran, EventArgs.Empty);
            }
            finally
            {
                ////Cache.Clear(); // State "rollback" in cache. TODO: cache clear in cluster must be ensured.
                ////CACHE: Ez sose mûködött jól... Cache.Clear kéne.
                //DistributedApplication.Cache.Reset();

                ContextHandler.SetTransaction(null);
                ContextHandler.SetTransactionQueue(null);
                tran.Dispose();
            }
        }