Share via


PreparingEnlistment.ForceRollback 메서드

정의

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

오버로드

ForceRollback()

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

ForceRollback(Exception)

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

ForceRollback()

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

public:
 void ForceRollback();
public void ForceRollback ();
member this.ForceRollback : unit -> unit
Public Sub ForceRollback ()

예제

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 구현은 트랜잭션을 IEnlistmentNotification 롤백해야 함을 나타내기 위해 이 메서드를 호출합니다.

적용 대상

ForceRollback(Exception)

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

public:
 void ForceRollback(Exception ^ e);
public:
 void ForceRollback(Exception ^ ex);
public void ForceRollback (Exception? e);
public void ForceRollback (Exception e);
public void ForceRollback (Exception ex);
member this.ForceRollback : Exception -> unit
member this.ForceRollback : Exception -> unit
Public Sub ForceRollback (e As Exception)
Public Sub ForceRollback (ex As Exception)

매개 변수

eex
Exception

롤백이 트리거되는 이유에 대한 설명입니다.

적용 대상