SqlConnectionStringBuilder.TransactionBinding Property

Definition

获取或设置一个字符串值,该值表示连接如何保持与登记的 System.Transactions 事务的关联。Gets or sets a string value that indicates how the connection maintains its association with an enlisted System.Transactions transaction.

public:
 property System::String ^ TransactionBinding { System::String ^ get(); void set(System::String ^ value); };
public string TransactionBinding { get; set; }
member this.TransactionBinding : string with get, set
Public Property TransactionBinding As String

Property Value

String

TransactionBinding 属性的值,或者,如果未提供任何值,则为 String.EmptyThe value of the TransactionBinding property, or String.Empty if none has been supplied.

Remarks

ConnectionString 中的事务绑定关键字控制 SqlConnection 如何绑定到登记的 TransactionThe Transaction Binding keywords in a ConnectionString control how a SqlConnection binds to an enlisted Transaction.

下表列出了 TransactionBinding 属性的可能值:The following table shows the possible values for the TransactionBinding property:

Value 说明Description
Implicit UnbindImplicit Unbind 默认值。The default. 事务结束时,使连接与事务分离。Causes the connection to detach from the transaction when it ends. 分离后,在自动模式下对连接执行其他请求。After detaching, additional requests on the connection are performed in autocommit mode. 在事务处于活动状态的情况下,执行请求时不会检查 Current 属性。The Current property is not checked when executing requests while the transaction is active. 事务结束后,会在自动提交模式下执行其他请求。After the transaction has ended, additional requests are performed in autocommit mode.
Explicit UnbindExplicit Unbind 导致连接在关闭之前连接到事务,或直到使用 nullNothing Visual Basic)值调用 EnlistTransactionCauses the connection to remain attached to the transaction until the connection is closed or until EnlistTransaction is called with a null (Nothing in Visual Basic) value. 如果 InvalidOperationException 不是登记事务或者登记事务未处于活动状态,则将引发 CurrentAn InvalidOperationException is thrown if Current is not the enlisted transaction or if the enlisted transaction is not active. 此行为强制实施 TransactionScope 支持所需的严格范围限定规则。This behavior enforces the strict scoping rules required for TransactionScope support.

Applies to

See also