PreparingEnlistment 클래스

정의

트랜잭션의 준비 단계에서 참여 한 트랜잭션 참가 요소와 트랜잭션 관리자 간의 통신을 용이 하 게 합니다.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
상속
PreparingEnlistment

예제

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.

또한 리소스 관리자는 Prepared 메서드를 호출 하기 전에 언제 든 지 Done 메서드를 호출할 수 있습니다.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()

트랜잭션 참가 요소가 작업을 완료 했음을 나타냅니다.Indicates that the transaction participant has completed its work.

(다음에서 상속됨 Enlistment)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
ForceRollback()

트랜잭션을 롤백해야 함을 나타냅니다.Indicates that the transaction should be rolled back.

ForceRollback(Exception)

트랜잭션을 롤백해야 함을 나타냅니다.Indicates that the transaction should be rolled back.

GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
Prepared()

트랜잭션이 커밋될 수 있음을 나타냅니다.Indicates that the transaction can be committed.

RecoveryInformation()

참여 항목의 복구 정보를 가져옵니다.Gets the recovery information of an enlistment.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

적용 대상

스레드 보안

이 형식은 스레드로부터 안전합니다.This type is thread safe.

추가 정보