PreparingEnlistment 클래스

정의

트랜잭션의 준비 단계에서 참여한 트랜잭션 참가 요소와 트랜잭션 관리자 간의 통신을 용이하게 합니다.

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 하여 이 형식을 리소스 관리자에게 전달하여 트랜잭션에 대한 리소스의 투표를 얻습니다. 커밋 또는 롤백 투표 여부에 따라 리소스 관리자 구현에서 이 형식의 메서드 또는 ForceRollback 메서드를 Prepared 호출해야 합니다.

또한 리소스 관리자는 메서드를 Done 호출하기 전에 언제든지 메서드를 호출할 Prepared 수 있습니다. 이렇게 함으로써 인리스트먼트는 읽기 전용 투표를 캐스팅합니다. 즉, 트랜잭션에 대한 커밋에 투표하지만 최종 결과를 받을 필요는 없습니다.

지속성 리소스 관리자는 속성에서 다시 등록하기 위해 트랜잭션 관리자가 필요한 정보를 검색할 RecoveryInformation 수 있습니다. 복구에 대한 자세한 내용은 복구 수행을 참조하세요.

메서드

Done()

트랜잭션 참가 요소가 작업을 완료했음을 나타냅니다.

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

지정된 개체가 현재 개체와 같은지 확인합니다.

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

트랜잭션을 롤백해야 함을 나타냅니다.

ForceRollback(Exception)

트랜잭션을 롤백해야 함을 나타냅니다.

GetHashCode()

기본 해시 함수로 작동합니다.

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

현재 인스턴스의 Type을 가져옵니다.

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

현재 Object의 단순 복사본을 만듭니다.

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

트랜잭션이 커밋될 수 있음을 나타냅니다.

RecoveryInformation()

참여 항목의 복구 정보를 가져옵니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

스레드 보안

이 형식은 스레드로부터 안전합니다.

추가 정보