Notifies an enlisted object that a transaction is being prepared for commitment.
Assembly: System.Transactions (in System.Transactions.dll)
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 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.