PreparingEnlistment.Prepared メソッド
アセンブリ: System.Transactions (system.transactions.dll 内)


2 フェーズ コミットの最初の (準備) フェーズにおいて、IEnlistmentNotification インターフェイスの Prepare メソッドを実装するリソース マネージャは、このメソッドを呼び出して、トランザクションをコミットできることを示します。
リソース マネージャは、このメソッドを呼び出す前に、いつでも Done メソッドを呼び出すことができます。これにより、参加リストは読み取り専用の決定をキャストします。これは、トランザクションはコミットするが、最終結果を受け取る必要がないことを意味します。
このメソッドが参加リストによって呼び出されてから値を返すまでの間、この同じスレッドまたは別のスレッドは、同じ参加リスト メソッド (Rollback など) を呼び出してロールバックを実行できます。これにより、このメソッドが値を返すまでリソース マネージャの実装がリソース ロックを解放しない場合は、デッドロック状態になる可能性があります。

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(); } }

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


Weblioに収録されているすべての辞書からPreparingEnlistment.Prepared メソッドを検索する場合は、下記のリンクをクリックしてください。

- PreparingEnlistment.Prepared メソッドのページへのリンク