PreparingEnlistment PreparingEnlistment PreparingEnlistment PreparingEnlistment Class

定義

トランザクションの準備フェーズにおいて、参加するトランザクションの参加要素とトランザクション マネージャーの間の通信を容易にします。Facilitates communication between an enlisted transaction participant and the transaction manager during the Prepare phase of the transaction.

public ref class PreparingEnlistment : System::Transactions::Enlistment
public class PreparingEnlistment : System.Transactions.Enlistment
type PreparingEnlistment = class
    inherit Enlistment
Public Class PreparingEnlistment
Inherits Enlistment
継承
PreparingEnlistmentPreparingEnlistmentPreparingEnlistmentPreparingEnlistment

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

注釈

トランザクションの初期 (準備) フェーズでは、トランザクションマネージャーは、メソッドをPrepare呼び出してトランザクションに対するリソースの投票を取得することによって、この型をリソースマネージャーに渡します。During the initial (prepare) phase of the transaction, the transaction manager passes this type to the resource manager by calling the Prepare method to obtain a resource's vote on the transaction. コミットまたはロールバックするかどうかに応じて、リソースマネージャーの実装でPreparedは、この型のメソッドまたはForceRollbackメソッドを呼び出す必要があります。Depending on whether it votes to commit or roll back, your implementation of the resource manager should call the Prepared or ForceRollback methods of this type.

リソースマネージャーは、 Done Preparedメソッドを呼び出す前に、いつでもメソッドを呼び出すことができます。The resource manager can also call the Done method at anytime before it has called the Prepared method. これにより、参加リストは読み取り専用の投票にキャストします。つまり、トランザクションに対してコミットを投票しますが、最終的な結果を受け取る必要はありません。By doing so, the enlistment is casting a read only vote, meaning that it votes commit on the transaction but does not need to receive the final outcome.

持続性のあるリソースマネージャーは、トランザクションマネージャーがRecoveryInformationプロパティから再参加するために必要な情報を取得できます。Durable resource managers can retrieve the information that is be needed by the transaction manager for re-enlistment from the RecoveryInformation property. 回復の詳細については、「回復の実行」を参照してください。For more information on recovery, see Performing Recovery.

メソッド

Done() Done() Done() Done()

トランザクション参加要素が作業を完了したことを示します。Indicates that the transaction participant has completed its work.

(Inherited from Enlistment)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
ForceRollback() ForceRollback() ForceRollback() ForceRollback()

トランザクションをロールバックする必要があることを示します。Indicates that the transaction should be rolled back.

ForceRollback(Exception) ForceRollback(Exception) ForceRollback(Exception) ForceRollback(Exception)

トランザクションをロールバックする必要があることを示します。Indicates that the transaction should be rolled back.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
Prepared() Prepared() Prepared() Prepared()

トランザクションをコミットできることを示します。Indicates that the transaction can be committed.

RecoveryInformation() RecoveryInformation() RecoveryInformation() RecoveryInformation()

参加リストの修復情報を取得します。Gets the recovery information of an enlistment.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

スレッド セーフ

この型はスレッド セーフです。This type is thread safe.

こちらもご覧ください