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 )");
}
}