Enlistment クラス
アセンブリ: System.Transactions (system.transactions.dll 内)


トランザクションに参加要素を参加させるために 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.Transactions.Enlistment
System.Transactions.PreparingEnlistment
System.Transactions.SinglePhaseEnlistment


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Enlistment メソッド

名前 | 説明 | |
---|---|---|
![]() | Done | トランザクション参加要素が作業を完了したことを示します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

Enlistment メンバ
トランザクションの最終フェーズにおいて、トランザクションに参加している参加要素とトランザクション マネージャの間の通信を容易にします。
Enlistment データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | Done | トランザクション参加要素が作業を完了したことを示します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- Enlistmentのページへのリンク