/// <summary>
        /// Close the TransactionScope
        /// </summary>
        public void Close()
        {
            if (_closed == false)
            {
                if (_logger.IsDebugEnabled)
                {
                    _logger.Debug("Close TransactionScope");
                }

                if (ContextUtil.IsInTransaction)
                {
                    if (_consistent == true && (this.IsVoteCommit))
                    {
                        ContextUtil.EnableCommit();
                    }
                    else
                    {
                        ContextUtil.DisableCommit();
                    }
                }

                if (0 == --TransactionScopeCount)
                {
                    if (_logger.IsDebugEnabled)
                    {
                        _logger.Debug("Leave in ServiceDomain ");
                    }

                    ServiceDomain.Leave();
                }

                _closed = true;
            }
        }
示例#2
0
 public void Close()
 {
     if (!this._closed)
     {
         if (_logger.IsDebugEnabled)
         {
             _logger.Debug("Close TransactionScope");
         }
         if (ContextUtil.IsInTransaction)
         {
             if (this._consistent && this.IsVoteCommit)
             {
                 ContextUtil.EnableCommit();
             }
             else
             {
                 ContextUtil.DisableCommit();
             }
         }
         if (--this.TransactionScopeCount == 0)
         {
             if (_logger.IsDebugEnabled)
             {
                 _logger.Debug("Leave in ServiceDomain ");
             }
             ServiceDomain.Leave();
         }
         this._closed = true;
     }
 }
示例#3
0
 public virtual object ExecuteMethod(object o, string method, params object[] p)
 {
     try
     {
         //use the reflection to invoke the business method within the current transaction scope.
         return(o.GetType().InvokeMember(method, BindingFlags.InvokeMethod, null, o, p));
     }
     catch (Exception ex)
     {
         //if exception occurs, mark the current transaction as such so that we can
         //rollback the transaction later.
         if (ContextUtil.IsInTransaction)
         {
             ContextUtil.DisableCommit();
         }
         //rethow the exception to notify the caller.
         throw ex;
     }
 }
 public void Example()
 {
     // Set both the consistent bit and the done bit to false for the
     // current COM+ context.
     ContextUtil.DisableCommit();
 }