DbConnection.EnlistTransaction(Transaction) DbConnection.EnlistTransaction(Transaction) DbConnection.EnlistTransaction(Transaction) Method

定义

在指定事务中登记。Enlists in the specified transaction.

public:
 virtual void EnlistTransaction(System::Transactions::Transaction ^ transaction);
public virtual void EnlistTransaction (System.Transactions.Transaction transaction);
abstract member EnlistTransaction : System.Transactions.Transaction -> unit
override this.EnlistTransaction : System.Transactions.Transaction -> unit

参数

transaction
Transaction Transaction Transaction

对用于登记的现有 Transaction 的引用。A reference to an existing Transaction in which to enlist.

注解

ADO.NET 2.0 中的新增项支持使用 EnlistTransaction 方法在分布式事务中登记。New in ADO.NET 2.0 is support for using the EnlistTransaction method to enlist in a distributed transaction. 由于它在 Transaction 实例中登记连接,EnlistTransaction 利用 System.Transactions 命名空间中提供的功能来管理分布式事务。Because it enlists a connection in a Transaction instance, EnlistTransaction takes advantage of functionality available in the System.Transactions namespace for managing distributed transactions. 在事务中显式登记某个连接后,在第一个事务完成之前,该连接将无法取消登记或登记到另一个事务中。Once a connection is explicitly enlisted in a transaction, it cannot be unenlisted or enlisted in another transaction until the first transaction finishes.

适用于

另请参阅