TransactionScopeOption 枚举


提供用于创建事务范围的附加选项。Provides additional options for creating a transaction scope.

public enum class TransactionScopeOption
public enum TransactionScopeOption
type TransactionScopeOption = 
Public Enum TransactionScopeOption


Required 0

该范围需要一个事务。A transaction is required by the scope. 如果已经存在环境事务,则使用该环境事务。It uses an ambient transaction if one already exists. 否则,在进入范围之前创建新的事务。Otherwise, it creates a new transaction before entering the scope. 此为默认值。This is the default value.

RequiresNew 1

总是为该范围创建新事务。A new transaction is always created for the scope.

Suppress 2

环境事务上下文在创建范围时被取消。The ambient transaction context is suppressed when creating the scope. 范围中的所有操作都在无环境事务上下文的情况下完成。All operations within the scope are done without an ambient transaction context.


TransactionScopeOption 枚举传递到 TransactionScope 类的各种构造函数,以定义范围的事务行为。The TransactionScopeOption enumeration is passed to the various constructors of the TransactionScope class to define the transactional behavior of the scope. 有关如何使用此枚举的详细信息,请参阅使用事务范围实现隐式事务中的 "使用 TransactionScopeOption 管理事务流" 一节。For more information on how this enumeration is used, see the "Managing Transaction Flow using TransactionScopeOption" section in Implementing An Implicit Transaction Using Transaction Scope.