Enlistmentとは? わかりやすく解説

Enlistment クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

トランザクション最終フェーズにおいて、トランザクション参加している参加要素トランザクション マネージャの間の通信容易にます。

名前空間: System.Transactions
アセンブリ: System.Transactions (system.transactions.dll 内)
構文構文

public class Enlistment
public ref class Enlistment
public class Enlistment
public class Enlistment
解説解説

トランザクション参加要素参加させるために Transaction オブジェクトの EnlistVolatile メソッドおよび EnlistDurable メソッド呼び出すと、参加リストを示すこのオブジェクト返されます。

トランザクションコミット最終フェーズで、トランザクション マネージャは、このオブジェクトトランザクション参加している IEnlistmentNotification インターフェイス実装するリソース マネージャ渡します。特に、トランザクション マネージャは、リソース マネージャトランザクションコミット決定しているか、またはロールバック実行決定しているかに基づいて参加要素Commit メソッドまたは Rollback メソッド呼び出します。参加要素は、このオブジェクトDone メソッド呼び出してトランザクション マネージャ作業完了通知する必要があります

参加リストは、準備フェーズPrepared呼び出す前に、いつでも Done メソッド呼び出すことができます。これにより、参加リスト読み取り専用決定行います。これは、トランザクションコミットするが、最終結果受け取必要がないことを意味しますDone メソッド呼び出し後、登録されている参加要素は、トランザクション マネージャからさらに通知受け取ることはありません。

使用例使用例

IEnlistmentNotification インターフェイス実装と、Done メソッド呼び出す必要がある場合を表す例を次に示します

Public Class EnlistmentClass
    Implements IEnlistmentNotification

    Public Sub Prepare(ByVal
 myPreparingEnlistment As PreparingEnlistment) Implements
 System.Transactions.IEnlistmentNotification.Prepare
        Console.WriteLine("Prepare notification received")

        'Perform transactional work

        'If work finished correctly, reply with prepared
        myPreparingEnlistment.Prepared()
    End Sub

    Public Sub Commit(ByVal
 myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.Commit
        Console.WriteLine("Commit notification received")

        'Do any work necessary when commit notification is received

        'Declare done on the enlistment
        myEnlistment.Done()
    End Sub

    Public Sub Rollback(ByVal
 myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.Rollback
        Console.WriteLine("Rollback notification received")

        'Do any work necessary when rollback notification is received

        'Declare done on the enlistment
        myEnlistment.Done()
    End Sub

    Public Sub InDoubt(ByVal
 myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.InDoubt
        Console.WriteLine("In doubt notification received")

        'Do any work necessary when indout notification is received

        'Declare done on the enlistment
        myEnlistment.Done()
    End Sub
End Class
class myEnlistmentClass : IEnlistmentNotification
{
    public void Prepare(PreparingEnlistment
 preparingEnlistment)
    {
        Console.WriteLine("Prepare notification received");

        //Perform transactional work

        //If work finished correctly, reply prepared
        preparingEnlistment.Prepared();

        // otherwise, do a ForceRollback
        preparingEnlistment.ForceRollback();
    }

    public void Commit(Enlistment enlistment)
    {
        Console.WriteLine("Commit notification received");

        //Do any work necessary when commit notification is received

        //Declare done on the enlistment
        enlistment.Done();
    }

    public void Rollback(Enlistment enlistment)
    {
        Console.WriteLine("Rollback notification received");

        //Do any work necessary when rollback notification is received

        //Declare done on the enlistment
        enlistment.Done();
    }

    public void InDoubt(Enlistment enlistment)
    {
        Console.WriteLine("In doubt notification received");

        //Do any work necessary when indout notification is received
        
        //Declare done on the enlistment
        enlistment.Done();
    }
}
継承階層継承階層
System.Object
  System.Transactions.Enlistment
     System.Transactions.PreparingEnlistment
     System.Transactions.SinglePhaseEnlistment
スレッド セーフスレッド セーフ

この型は、マルチスレッド操作に対して安全です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Enlistment メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Enlistment クラス
System.Transactions 名前空間
PreparingEnlistment
IEnlistmentNotification

その他の技術情報

トランザクションへの参加要素としてのリソースの登録

Enlistment メンバ

トランザクション最終フェーズにおいて、トランザクション参加している参加要素トランザクション マネージャの間の通信容易にます。

Enlistment データ型公開されるメンバを以下の表に示します


パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Enlistment クラス
System.Transactions 名前空間
PreparingEnlistment
IEnlistmentNotification

その他の技術情報

トランザクションへの参加要素としてのリソースの登録



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Enlistment」の関連用語

Enlistmentのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Enlistmentのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS