TransactionManager.Reenlist(Guid, Byte[], IEnlistmentNotification) 方法  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在事务中重新登记持久参与者。
public:
 static System::Transactions::Enlistment ^ Reenlist(Guid resourceManagerIdentifier, cli::array <System::Byte> ^ recoveryInformation, System::Transactions::IEnlistmentNotification ^ enlistmentNotification);public:
 static System::Transactions::Enlistment ^ Reenlist(Guid manager, cli::array <System::Byte> ^ recoveryInfo, System::Transactions::IEnlistmentNotification ^ notification);public static System.Transactions.Enlistment Reenlist (Guid resourceManagerIdentifier, byte[] recoveryInformation, System.Transactions.IEnlistmentNotification enlistmentNotification);public static System.Transactions.Enlistment Reenlist (Guid manager, byte[] recoveryInfo, System.Transactions.IEnlistmentNotification notification);static member Reenlist : Guid * byte[] * System.Transactions.IEnlistmentNotification -> System.Transactions.Enlistmentstatic member Reenlist : Guid * byte[] * System.Transactions.IEnlistmentNotification -> System.Transactions.EnlistmentPublic Shared Function Reenlist (resourceManagerIdentifier As Guid, recoveryInformation As Byte(), enlistmentNotification As IEnlistmentNotification) As EnlistmentPublic Shared Function Reenlist (manager As Guid, recoveryInfo As Byte(), notification As IEnlistmentNotification) As Enlistment参数
- recoveryInformationrecoveryInfo
- Byte[]
包含恢复信息的附加信息。
- enlistmentNotificationnotification
- IEnlistmentNotification
实现 IEnlistmentNotification 以接收通知的资源对象。
返回
描述登记的 Enlistment。
例外
recoveryInformation 无效。
- 或 - - recoveryInformation中的“事务管理器”信息与已配置的事务管理器不匹配。
- 或 - System.Transactions 未能识别 - RecoveryInformation。
已经为指定的 resourceManagerIdentifier 调用 RecoveryComplete(Guid)。 重新登记被拒绝。
resourceManagerIdentifier 与 recoveryInformation 中的指定恢复信息的内容不匹配。
注解
重要
使用不受信任的数据调用此方法存在安全风险。 仅使用受信任的数据调用此方法。 有关详细信息,请参阅 “验证所有输入”。
资源管理器通过在资源失败之后重新登记事务参与者来促进事务中的持久登记的解决。
该 resourceManagerIdentifier 参数用于在发生资源故障时一致地标记事务的参与者。 调用 Reenlist 该方法时,资源管理器必须提供 resourceManagerIdentifier 与最初在登记期间调用 EnlistDurable 该方法时所用的相同,或引发方法 TransactionException 。
当使用此方法重新登记参与者时,将相应地调用对应于事务结果的 IEnlistmentNotification 的第 2 阶段方法(即 Commit、Rollback 或 InDoubt)。
成功重新登记参与者后,应调用以 RecoveryComplete 完成恢复。
仅当资源管理器从失败重启时,才应调用此方法。 此外,应该仅重新登记在两阶段提交的初始准备阶段中由资源管理器记录的未解决事务。 在无效的时间调用此方法的任何尝试都可能产生错误的结果。
如果事务管理器失败,并且资源管理器仅在调用Two-Phase提交协议第 1 阶段的方法后 Prepared ,才执行恢复,则资源管理器可能会接收 InDoubt 或 Rollback 回调。
有关恢复的更多信息,请参见执行恢复。
注意 此方法用于 LinkDemand 防止从不受信任的代码调用它;但是,只有直接调用方才需要拥有 FullTrust 权限集。