Transaction.SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid) 方法

定义

设置由非 MSDTC 提升程序生成的分布式事务标识符。Sets the distributed transaction identifier generated by the non-MSDTC promoter.

public:
 void SetDistributedTransactionIdentifier(System::Transactions::IPromotableSinglePhaseNotification ^ promotableNotification, Guid distributedTransactionIdentifier);
public void SetDistributedTransactionIdentifier (System.Transactions.IPromotableSinglePhaseNotification promotableNotification, Guid distributedTransactionIdentifier);
member this.SetDistributedTransactionIdentifier : System.Transactions.IPromotableSinglePhaseNotification * Guid -> unit
Public Sub SetDistributedTransactionIdentifier (promotableNotification As IPromotableSinglePhaseNotification, distributedTransactionIdentifier As Guid)

参数

promotableNotification
IPromotableSinglePhaseNotification

由参与者实现的 IPromotableSinglePhaseNotification 接口。A IPromotableSinglePhaseNotification interface implemented by the participant.

distributedTransactionIdentifier
Guid

分布式事务管理器使用的事务的标识符。The identifier for the transaction used by the distributed transaction manager.

注解

仅当处理 IPromotableSinglePhaseNotification.Promote 方法时,才能成功调用此方法。This method can only be called successfully while the IPromotableSinglePhaseNotification.Promote method is being processed. 如果在任何其他时间调用此方法,则会引发 TransactionExceptionIf this method is called at any other time, a TransactionException is thrown.

promotableNotification 参数的指定值必须是最初指定给 Transaction.EnlistPromotableSinglePhase 调用的同一对象。The specified value of the promotableNotification parameter must be the same object that was originally specified to the Transaction.EnlistPromotableSinglePhase invocation. 如果不是这种情况,则会引发 InvalidOperationExceptionIf this is not the case, then an InvalidOperationException is thrown.

适用于