Share via


TransactionManager.Reenlist(Guid, Byte[], IEnlistmentNotification) 方法

定義

重新登記交易中的長期參與者。

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.Enlistment
static member Reenlist : Guid * byte[] * System.Transactions.IEnlistmentNotification -> System.Transactions.Enlistment
Public Shared Function Reenlist (resourceManagerIdentifier As Guid, recoveryInformation As Byte(), enlistmentNotification As IEnlistmentNotification) As Enlistment
Public Shared Function Reenlist (manager As Guid, recoveryInfo As Byte(), notification As IEnlistmentNotification) As Enlistment

參數

resourceManagerIdentifiermanager
Guid

Guid,可唯一識別資源管理員。

recoveryInformationrecoveryInfo
Byte[]

包含復原資訊的其他資訊。

enlistmentNotificationnotification
IEnlistmentNotification

實作 IEnlistmentNotification 以接收告知的資源物件。

傳回

Enlistment

描述登記 (Enlistment) 的 Enlistment

例外狀況

recoveryInformation 無效。

-或- recoveryInformation 中的交易管理員資訊不符合所設定的交易管理員。

-或- System.Transactions 無法辨識 RecoveryInformation

已經為每個指定的 resourceManagerIdentifier 呼叫 RecoveryComplete(Guid)。 重新登記遭拒。

resourceManagerIdentifier 不符合 recoveryInformation 中指定之復原資訊的內容。

備註

重要

使用不信任的資料呼叫此方法,會造成安全性上的風險。 呼叫此方法時,請一律使用信任的資料。 如需詳細資訊,請參閱 驗證所有輸入

資源管理員會在資源失敗後重新登記異動參與者,以協助解析異動中的永久性登記。

參數 resourceManagerIdentifier 用來在發生資源失敗時,一致地標記交易的參與者。 呼叫 Reenlist 方法時,資源管理員必須提供與原先在登記期間呼叫 EnlistDurable 方法時所使用的相同 resourceManagerIdentifier ,否則 TransactionException 會擲回 。

當使用這個方法重新登記參與者時,會依適合的情況呼叫對應至異動結果 (也就是,IEnlistmentNotificationCommitRollback) 之 InDoubt 的第二階段方法。

成功重新登記參與者之後,您應該接著呼叫 RecoveryComplete 以完成復原。

只有在資源管理員從失敗重新開機時,才應該呼叫這個方法。 此外,您只應該重新登記無法解析的交易,這些交易是由資源管理員在兩階段交易認可 (Two-Phase Commit) 的初始準備階段所記錄。 任何嘗試在無效時間呼叫這個方法的動作,都可能產生錯誤性結果。

如果交易管理員失敗,而且您的 Prepared 資源管理員只會在呼叫 Two-Phase Commit 通訊協定第 1 階段中的 方法之後,執行復原,您的資源管理員可能會收到 InDoubtRollback 回呼。

如需復原的詳細資訊,請參閱 執行復原

注意 這個方法會使用 LinkDemand 來防止從不受信任的程式碼呼叫它;不過,只有立即呼叫端才能擁有 FullTrust 許可權集合。

適用於

另請參閱