ISinglePhaseNotification 介面

定義

描述一個支援單階段提交優化以參與交易的資源物件。

public interface class ISinglePhaseNotification : System::Transactions::IEnlistmentNotification
public interface ISinglePhaseNotification : System.Transactions.IEnlistmentNotification
type ISinglePhaseNotification = interface
    interface IEnlistmentNotification
Public Interface ISinglePhaseNotification
Implements IEnlistmentNotification
實作

備註

你應該注意,即使你的資源管理器實作了這個介面來支援單階段提交優化,也不保證它會收到單階段提交。 交易管理器仍可發送兩階段提交通知。

若要將資源管理員列為交易參與者,請呼叫 EnlistVolatile 該類別 EnlistDurable 的方法 Transaction 或方法。 具體來說, EnlistmentOptions 參數應等於 , None 以確保執行單階段提交。 若錯誤設定為 EnlistDuringPrepareRequired,則不會發生單一階段提交。

由於 ISinglePhaseNotification 介面源自介面 IEnlistmentNotification ,資源管理器也必須實作該介面的所有方法,以實現兩階段提交通知。 交易管理器可自行決定是否使用兩階段提交或單階段提交優化。 然而,實作此介面讓資源管理者有機會在優化可用時加以利用。

若已使用最佳化且交易管理器呼叫 SinglePhaseCommit 所列資源的方法,資源管理器應透過該類別的各種方法 SinglePhaseEnlistment 回應此呼叫,告知交易是否要提交或回滾交易。

方法

名稱 Description
Commit(Enlistment)

通知一個已登記的物件交易正在提交。

(繼承來源 IEnlistmentNotification)
InDoubt(Enlistment)

通知被列入的對象交易狀態存疑。

(繼承來源 IEnlistmentNotification)
Prepare(PreparingEnlistment)

通知一個已登記的物件,交易正在準備提交。

(繼承來源 IEnlistmentNotification)
Rollback(Enlistment)

通知一個已登記的物件,交易正在回滾(中止)。

(繼承來源 IEnlistmentNotification)
SinglePhaseCommit(SinglePhaseEnlistment)

代表資源管理員對單階段提交優化回調的實作。

適用於

另請參閱