Export (0) Print
Expand All

PreparingEnlistment.ForceRollback Method

Indicates that the transaction should be rolled back.

Namespace:  System.Transactions
Assembly:  System.Transactions (in System.Transactions.dll)

'Declaration
Public Sub ForceRollback

An implementation of the Prepare method of the IEnlistmentNotification interface calls this method to indicate that the transaction must be rolled back.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft