public TransactionScope(TransactionScopeOption scopeOption, TransactionOptions transactionOptions, EnterpriseServicesInteropOption interopOption)
        {
            if (!TransactionManager._platformValidated)
            {
                TransactionManager.ValidatePlatform();
            }
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption, TransactionOptions, EnterpriseServicesInteropOption )");
            }
            this.ValidateScopeTimeout("transactionOptions.Timeout", transactionOptions.Timeout);
            TimeSpan timeout = transactionOptions.Timeout;

            transactionOptions.Timeout = TransactionManager.ValidateTimeout(transactionOptions.Timeout);
            TransactionManager.ValidateIsolationLevel(transactionOptions.IsolationLevel);
            this.ValidateInteropOption(interopOption);
            this.interopModeSpecified = true;
            this.interopOption        = interopOption;
            if (this.NeedToCreateTransaction(scopeOption))
            {
                this.committableTransaction = new CommittableTransaction(transactionOptions);
                this.expectedCurrent        = this.committableTransaction.Clone();
            }
            else if (((null != this.expectedCurrent) && (IsolationLevel.Unspecified != transactionOptions.IsolationLevel)) && (this.expectedCurrent.IsolationLevel != transactionOptions.IsolationLevel))
            {
                throw new ArgumentException(System.Transactions.SR.GetString("TransactionScopeIsolationLevelDifferentFromTransaction"), "transactionOptions.IsolationLevel");
            }
            if (((null != this.expectedCurrent) && (null == this.committableTransaction)) && (TimeSpan.Zero != timeout))
            {
                this.scopeTimer = new Timer(new System.Threading.TimerCallback(TransactionScope.TimerCallback), this, timeout, TimeSpan.Zero);
            }
            if (DiagnosticTrace.Information)
            {
                if (null == this.expectedCurrent)
                {
                    TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), TransactionTraceIdentifier.Empty, TransactionScopeResult.NoTransaction);
                }
                else
                {
                    TransactionScopeResult usingExistingCurrent;
                    if (null == this.committableTransaction)
                    {
                        usingExistingCurrent = TransactionScopeResult.UsingExistingCurrent;
                    }
                    else
                    {
                        usingExistingCurrent = TransactionScopeResult.CreatedTransaction;
                    }
                    TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), this.expectedCurrent.TransactionTraceId, usingExistingCurrent);
                }
            }
            this.PushScope();
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption, TransactionOptions, EnterpriseServicesInteropOption )");
            }
        }
        public TransactionScope(TransactionScopeOption scopeOption, TimeSpan scopeTimeout)
        {
            if (!TransactionManager._platformValidated)
            {
                TransactionManager.ValidatePlatform();
            }
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption, TimeSpan )");
            }
            this.ValidateScopeTimeout("scopeTimeout", scopeTimeout);
            TimeSpan timeout = TransactionManager.ValidateTimeout(scopeTimeout);

            if (this.NeedToCreateTransaction(scopeOption))
            {
                this.committableTransaction = new CommittableTransaction(timeout);
                this.expectedCurrent        = this.committableTransaction.Clone();
            }
            if (((null != this.expectedCurrent) && (null == this.committableTransaction)) && (TimeSpan.Zero != scopeTimeout))
            {
                this.scopeTimer = new Timer(new System.Threading.TimerCallback(TransactionScope.TimerCallback), this, scopeTimeout, TimeSpan.Zero);
            }
            if (DiagnosticTrace.Information)
            {
                if (null == this.expectedCurrent)
                {
                    TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), TransactionTraceIdentifier.Empty, TransactionScopeResult.NoTransaction);
                }
                else
                {
                    TransactionScopeResult usingExistingCurrent;
                    if (null == this.committableTransaction)
                    {
                        usingExistingCurrent = TransactionScopeResult.UsingExistingCurrent;
                    }
                    else
                    {
                        usingExistingCurrent = TransactionScopeResult.CreatedTransaction;
                    }
                    TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), this.expectedCurrent.TransactionTraceId, usingExistingCurrent);
                }
            }
            this.PushScope();
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption, TimeSpan )");
            }
        }
 private void Initialize(Transaction transactionToUse, TimeSpan scopeTimeout, bool interopModeSpecified)
 {
     if (null == transactionToUse)
     {
         throw new ArgumentNullException("transactionToUse");
     }
     this.ValidateScopeTimeout("scopeTimeout", scopeTimeout);
     this.CommonInitialize();
     if (TimeSpan.Zero != scopeTimeout)
     {
         this.scopeTimer = new Timer(new System.Threading.TimerCallback(TransactionScope.TimerCallback), this, scopeTimeout, TimeSpan.Zero);
     }
     this.expectedCurrent      = transactionToUse;
     this.interopModeSpecified = interopModeSpecified;
     if (DiagnosticTrace.Information)
     {
         TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), this.expectedCurrent.TransactionTraceId, TransactionScopeResult.TransactionPassed);
     }
     this.PushScope();
 }
 public TransactionScope(TransactionScopeOption scopeOption)
 {
     if (!TransactionManager._platformValidated)
     {
         TransactionManager.ValidatePlatform();
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption )");
     }
     if (this.NeedToCreateTransaction(scopeOption))
     {
         this.committableTransaction = new CommittableTransaction();
         this.expectedCurrent        = this.committableTransaction.Clone();
     }
     if (DiagnosticTrace.Information)
     {
         if (null == this.expectedCurrent)
         {
             TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), TransactionTraceIdentifier.Empty, TransactionScopeResult.NoTransaction);
         }
         else
         {
             TransactionScopeResult usingExistingCurrent;
             if (null == this.committableTransaction)
             {
                 usingExistingCurrent = TransactionScopeResult.UsingExistingCurrent;
             }
             else
             {
                 usingExistingCurrent = TransactionScopeResult.CreatedTransaction;
             }
             TransactionScopeCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), this.expectedCurrent.TransactionTraceId, usingExistingCurrent);
         }
     }
     this.PushScope();
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), "TransactionScope.ctor( TransactionScopeOption )");
     }
 }