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


トランザクションの初期 (準備) フェーズにおいて、トランザクション マネージャは、Prepare メソッドを呼び出して、この型をリソース マネージャに渡し、そのトランザクションに関するリソースの決定を取得します。コミットするかロールバックするかの決定に基づいて、リソース マネージャの実装は、この型の Prepared メソッドまたは ForceRollback メソッドを呼び出します。
また、リソース マネージャは、Prepared メソッドを呼び出す前に、いつでも Done メソッドを呼び出すことができます。これにより、参加リストは読み取り専用の決定をキャストします。これは、トランザクションはコミットするが、最終結果を受け取る必要がないことを意味します。
永続的リソース マネージャは、トランザクション マネージャが参加リストを再作成するために必要な情報を RecoveryInformation プロパティから取得できます。回復の詳細については、「回復の実行」を参照してください。

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


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- PreparingEnlistment クラスのページへのリンク