ערוך

שתף באמצעות


TransactionScope Constructors

Definition

Initializes a new instance of the TransactionScope class.

Overloads

TransactionScope()

Initializes a new instance of the TransactionScope class.

TransactionScope(Transaction)

Initializes a new instance of the TransactionScope class and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

TransactionScope(TransactionScopeAsyncFlowOption)

Initializes a new instance of the TransactionScope class with the specified asynchronous flow option.

TransactionScope(TransactionScopeOption)

Initializes a new instance of the TransactionScope class with the specified requirements.

TransactionScope(Transaction, TimeSpan)

Initializes a new instance of the TransactionScope class with the specified timeout value, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

TransactionScope(Transaction, TransactionScopeAsyncFlowOption)

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

TransactionScope(TransactionScopeOption, TimeSpan)

Initializes a new instance of the TransactionScope class with the specified timeout value and requirements.

TransactionScope(TransactionScopeOption, TransactionOptions)

Initializes a new instance of the TransactionScope class with the specified requirements.

TransactionScope(TransactionScopeOption, TransactionScopeAsyncFlowOption)

Initializes a new instance of the TransactionScope class with the specified requirements and asynchronous flow option.

TransactionScope(Transaction, TimeSpan, EnterpriseServicesInteropOption)

Initializes a new instance of the TransactionScope class with the specified timeout value and COM+ interoperability requirements, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

TransactionScope(Transaction, TimeSpan, TransactionScopeAsyncFlowOption)

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class with the specified timeout value, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

TransactionScope(TransactionScopeOption, TimeSpan, TransactionScopeAsyncFlowOption)

Initializes a new instance of the TransactionScope class with the specified timeout value, requirements, and asynchronous flow option.

TransactionScope(TransactionScopeOption, TransactionOptions, EnterpriseServicesInteropOption)

Initializes a new instance of the TransactionScope class with the specified scope and COM+ interoperability requirements, and transaction options.

TransactionScope(TransactionScopeOption, TransactionOptions, TransactionScopeAsyncFlowOption)

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class with the specified requirements and asynchronous flow option.

TransactionScope()

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class.

public:
 TransactionScope();
public TransactionScope ();
Public Sub New ()

Remarks

This constructor creates a new transaction scope with the transaction scope option equal to Required. This means that a transaction is required by the new scope and the ambient transaction is used if one already exists. Otherwise, it creates a new transaction before entering the scope.

See also

Applies to

TransactionScope(Transaction)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

public:
 TransactionScope(System::Transactions::Transaction ^ transactionToUse);
public TransactionScope (System.Transactions.Transaction transactionToUse);
new System.Transactions.TransactionScope : System.Transactions.Transaction -> System.Transactions.TransactionScope
Public Sub New (transactionToUse As Transaction)

Parameters

transactionToUse
Transaction

The transaction to be set as the ambient transaction, so that transactional work done inside the scope uses this transaction.

See also

Applies to

TransactionScope(TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified asynchronous flow option.

public:
 TransactionScope(System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to

TransactionScope(TransactionScopeOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified requirements.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

See also

Applies to

TransactionScope(Transaction, TimeSpan)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified timeout value, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

public:
 TransactionScope(System::Transactions::Transaction ^ transactionToUse, TimeSpan scopeTimeout);
public TransactionScope (System.Transactions.Transaction transactionToUse, TimeSpan scopeTimeout);
new System.Transactions.TransactionScope : System.Transactions.Transaction * TimeSpan -> System.Transactions.TransactionScope
Public Sub New (transactionToUse As Transaction, scopeTimeout As TimeSpan)

Parameters

transactionToUse
Transaction

The transaction to be set as the ambient transaction, so that transactional work done inside the scope uses this transaction.

scopeTimeout
TimeSpan

The TimeSpan after which the transaction scope times out and aborts the transaction.

See also

Applies to

TransactionScope(Transaction, TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

public:
 TransactionScope(System::Transactions::Transaction ^ transactionToUse, System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.Transaction transactionToUse, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.Transaction * System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (transactionToUse As Transaction, asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

transactionToUse
Transaction

The transaction to be set as the ambient transaction, so that transactional work done inside the scope uses this transaction.

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to

TransactionScope(TransactionScopeOption, TimeSpan)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified timeout value and requirements.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, TimeSpan scopeTimeout);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, TimeSpan scopeTimeout);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * TimeSpan -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, scopeTimeout As TimeSpan)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

scopeTimeout
TimeSpan

The TimeSpan after which the transaction scope times out and aborts the transaction.

See also

Applies to

TransactionScope(TransactionScopeOption, TransactionOptions)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified requirements.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, System::Transactions::TransactionOptions transactionOptions);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * System.Transactions.TransactionOptions -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, transactionOptions As TransactionOptions)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

transactionOptions
TransactionOptions

A TransactionOptions structure that describes the transaction options to use if a new transaction is created. If an existing transaction is used, the timeout value in this parameter applies to the transaction scope. If that time expires before the scope is disposed, the transaction is aborted.

Remarks

When you use the transactionOptions parameter to specify an IsolationLevel, and the scope creates a transaction later, the new transaction is associated with the specified isolation level. If an isolation level is passed in together with a transaction, the transaction must have an identical isolation level, or an exception is thrown.

See also

Applies to

TransactionScope(TransactionScopeOption, TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified requirements and asynchronous flow option.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to

TransactionScope(Transaction, TimeSpan, EnterpriseServicesInteropOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified timeout value and COM+ interoperability requirements, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

public:
 TransactionScope(System::Transactions::Transaction ^ transactionToUse, TimeSpan scopeTimeout, System::Transactions::EnterpriseServicesInteropOption interopOption);
public TransactionScope (System.Transactions.Transaction transactionToUse, TimeSpan scopeTimeout, System.Transactions.EnterpriseServicesInteropOption interopOption);
new System.Transactions.TransactionScope : System.Transactions.Transaction * TimeSpan * System.Transactions.EnterpriseServicesInteropOption -> System.Transactions.TransactionScope
Public Sub New (transactionToUse As Transaction, scopeTimeout As TimeSpan, interopOption As EnterpriseServicesInteropOption)

Parameters

transactionToUse
Transaction

The transaction to be set as the ambient transaction, so that transactional work done inside the scope uses this transaction.

scopeTimeout
TimeSpan

The TimeSpan after which the transaction scope times out and aborts the transaction.

interopOption
EnterpriseServicesInteropOption

An instance of the EnterpriseServicesInteropOption enumeration that describes how the associated transaction interacts with COM+ transactions.

See also

Applies to

TransactionScope(Transaction, TimeSpan, TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class with the specified timeout value, and sets the specified transaction as the ambient transaction, so that transactional work done inside the scope uses this transaction.

public:
 TransactionScope(System::Transactions::Transaction ^ transactionToUse, TimeSpan scopeTimeout, System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.Transaction transactionToUse, TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.Transaction * TimeSpan * System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (transactionToUse As Transaction, scopeTimeout As TimeSpan, asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

transactionToUse
Transaction

The transaction to be set as the ambient transaction, so that transactional work done inside the scope uses this transaction.

scopeTimeout
TimeSpan

The TimeSpan after which the transaction scope times out and aborts the transaction.

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to

TransactionScope(TransactionScopeOption, TimeSpan, TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified timeout value, requirements, and asynchronous flow option.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, TimeSpan scopeTimeout, System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * TimeSpan * System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, scopeTimeout As TimeSpan, asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

scopeTimeout
TimeSpan

The TimeSpan after which the transaction scope times out and aborts the transaction.

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to

TransactionScope(TransactionScopeOption, TransactionOptions, EnterpriseServicesInteropOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

Initializes a new instance of the TransactionScope class with the specified scope and COM+ interoperability requirements, and transaction options.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, System::Transactions::TransactionOptions transactionOptions, System::Transactions::EnterpriseServicesInteropOption interopOption);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.EnterpriseServicesInteropOption interopOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * System.Transactions.TransactionOptions * System.Transactions.EnterpriseServicesInteropOption -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, transactionOptions As TransactionOptions, interopOption As EnterpriseServicesInteropOption)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

transactionOptions
TransactionOptions

A TransactionOptions structure that describes the transaction options to use if a new transaction is created. If an existing transaction is used, the timeout value in this parameter applies to the transaction scope. If that time expires before the scope is disposed, the transaction is aborted.

interopOption
EnterpriseServicesInteropOption

An instance of the EnterpriseServicesInteropOption enumeration that describes how the associated transaction interacts with COM+ transactions.

Remarks

When you use the transactionOptions parameter to specify an IsolationLevel, and the scope creates a transaction later, the new transaction is associated with the specified isolation level. If an isolation level is passed in together with a transaction, the transaction must have an identical isolation level, or an exception is thrown.

See also

Applies to

TransactionScope(TransactionScopeOption, TransactionOptions, TransactionScopeAsyncFlowOption)

Source:
TransactionScope.cs
Source:
TransactionScope.cs
Source:
TransactionScope.cs

[Supported in the .NET Framework 4.5.1 and later versions]

Initializes a new instance of the TransactionScope class with the specified requirements and asynchronous flow option.

public:
 TransactionScope(System::Transactions::TransactionScopeOption scopeOption, System::Transactions::TransactionOptions transactionOptions, System::Transactions::TransactionScopeAsyncFlowOption asyncFlowOption);
public TransactionScope (System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption);
new System.Transactions.TransactionScope : System.Transactions.TransactionScopeOption * System.Transactions.TransactionOptions * System.Transactions.TransactionScopeAsyncFlowOption -> System.Transactions.TransactionScope
Public Sub New (scopeOption As TransactionScopeOption, transactionOptions As TransactionOptions, asyncFlowOption As TransactionScopeAsyncFlowOption)

Parameters

scopeOption
TransactionScopeOption

An instance of the TransactionScopeOption enumeration that describes the transaction requirements associated with this transaction scope.

transactionOptions
TransactionOptions

A TransactionOptions structure that describes the transaction options to use if a new transaction is created. If an existing transaction is used, the timeout value in this parameter applies to the transaction scope. If that time expires before the scope is disposed, the transaction is aborted.

asyncFlowOption
TransactionScopeAsyncFlowOption

An instance of the TransactionScopeAsyncFlowOption enumeration that describes whether the ambient transaction associated with the transaction scope will flow across thread continuations when using Task or async/await .NET async programming patterns.

Applies to