OleDbConnection.EnlistTransaction(Transaction) OleDbConnection.EnlistTransaction(Transaction) OleDbConnection.EnlistTransaction(Transaction) Method

定义

在指定的事务中登记为分布式事务。Enlists in the specified transaction as a distributed transaction.

public:
 override void EnlistTransaction(System::Transactions::Transaction ^ transaction);
public override void EnlistTransaction (System.Transactions.Transaction transaction);
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命名空间中的可用功能来管理分布式事务,使其更适合EnlistDistributedTransaction,它使用ITransaction对象。Because it enlists a connection in a Transaction instance, EnlistTransaction takes advantage of functionality available in the System.Transactions namespace for managing distributed transactions, making it preferable to EnlistDistributedTransaction, which uses a ITransaction object. 它还具有略微不同的语义:在事务中显式登记某个连接后,在第一个事务完成之前,不能取消登记该连接或在另一个事务中登记。It also has slightly different semantics: once a connection is explicitly enlisted on a transaction, it cannot be unenlisted or enlisted in another transaction until the first transaction finishes. 有关分布式事务的详细信息,请参阅分布式事务For more information about distributed transactions, see Distributed Transactions.

适用于

另请参阅