Assembly: System.Transactions (in system.transactions.dll)
'Declaration Sub Prepare ( _ preparingEnlistment As PreparingEnlistment _ ) 'Usage Dim instance As IEnlistmentNotification Dim preparingEnlistment As PreparingEnlistment instance.Prepare(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 Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.