/// <summary>
        /// <see cref="ITransactionManager.Dispose"/>.
        /// </summary>
        /// <param name="transaction"></param>
        public virtual void Dispose(ITransaction transaction)
        {
            //HACK:取消事务释放异常 changed by houkun 2010-9

            if (transaction == null)
            {
                _Logger.Debug("Tried to dispose a null transaction");
                return;
                //throw new ArgumentNullException("transaction", "Tried to dispose a null transaction");
            }
            if (CurrentTransaction != transaction)
            {
                _Logger.DebugFormat("Tried to dispose a transaction that is not on the current active transaction,{0}", transaction.Name);
                return;
                //throw new ArgumentException("Tried to dispose a transaction that is not on the current active transaction", "transaction");
            }

            _ActivityManager.CurrentActivity.Pop();

            if (transaction is IDisposable)
            {
                (transaction as IDisposable).Dispose();
            }

            if (transaction is IEventPublisher)
            {
                (transaction as IEventPublisher).TransactionCompleted  -= CompletedHandler;
                (transaction as IEventPublisher).TransactionFailed     -= FailedHandler;
                (transaction as IEventPublisher).TransactionRolledBack -= RolledBackHandler;
            }

            TransactionDisposed.Fire(this, new TransactionEventArgs(transaction));

            _Logger.DebugFormat("Transaction {0} disposed successfully", transaction.Name);
        }
        /// <summary>
        /// <see cref="ITransactionManager.Dispose"/>.
        /// </summary>
        /// <param name="transaction"></param>
        public virtual void Dispose(ITransaction transaction)
        {
            if (transaction == null)
            {
                throw new ArgumentNullException("transaction", "Tried to dispose a null transaction");
            }

            logger.DebugFormat("Trying to dispose transaction {0}.", transaction.Name);

            if (CurrentTransaction != transaction)
            {
                throw new ArgumentException("Tried to dispose a transaction that is not on the current active transaction",
                                            "transaction");
            }

            activityManager.CurrentActivity.Pop();

            if (transaction is IDisposable)
            {
                (transaction as IDisposable).Dispose();
            }

            if (transaction is IEventPublisher)
            {
                (transaction as IEventPublisher).TransactionCompleted  -= CompletedHandler;
                (transaction as IEventPublisher).TransactionFailed     -= FailedHandler;
                (transaction as IEventPublisher).TransactionRolledBack -= RolledBackHandler;
            }

            TransactionDisposed.Fire(this, new TransactionEventArgs(transaction));

            logger.DebugFormat("Transaction {0} disposed successfully", transaction.Name);
        }