Export (0) Print
Expand All

IEnlistmentNotification.Prepare Method

Note: This method is new in the .NET Framework version 2.0.

Notifies an enlisted object that a transaction is being prepared for commitment.

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

void Prepare (
	PreparingEnlistment^ preparingEnlistment
)
void Prepare (
	PreparingEnlistment preparingEnlistment
)
function Prepare (
	preparingEnlistment : PreparingEnlistment
)

Parameters

preparingEnlistment

A PreparingEnlistment object used to send a response to the transaction manager.

The transaction manager calls this method of an enlisted resource manager during the phase 1 of a commitment, when it asks participants whether they can commit the transaction.

When you are implementing a durable resource manager, you should log your prepare record during this phase. The record should contain all the necessary information to perform recovery. This includes the RecoveryInformation property, which is passed to the transaction manager in the Reenlist method during recovery. For more information on recovery, see Performing Recovery.

Your resource manager should complete all work that must be finished before calling the Prepared method of the preparingEnlistment parameter to indicate its vote for commitment. You should make sure that this is accomplished before receiving any phase 2 notification such as commit, rollback or in doubt. This is because phase 2 notifications can happen inline on the same thread that called the Prepared method in phase 1. As such, you should not do any work after the Prepared call (for example, releasing locks) that you would expect to have completed before receiving the phase 2 notifications.

You can also call the method of the preparingEnlistment parameter to indicate a vote for rollback.

If you want the object to merely observe and react to the progress of the transaction, without participating in it, your implementation of this method should call the Done method of the preparingEnlistment parameter when it has finished its work. By doing so, your resource manager would not receive any phase 2 notification.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft