共用方式為


ITransactionResourceAsync::PrepareRequest

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The DTC proxy calls this method to prepare a transaction (phase one of the two-phase commit protocol).

Syntax

  
HRESULT PrepareRequest(   BOOL fRetaining,  DWORD grfRM,  BOOL fWantMoniker,  BOOL fSinglePhase);  

Parameters

fRetaining
[in] Always FALSE.

grfRM
[in] Values from XACTRM.

fWantMoniker
[in] Always FALSE

fSinglePhase
[in] If TRUE, it indicates that the RM is the only resource manager enlisted on the transaction.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK
Success. The resource manager's transaction object has started preparing.

Remarks

The resource manager needs to return from this call as soon as it has asynchronously started a request to prepare its enlistment object. After the enlistment object is prepared, the resource manager needs to call ITransactionEnlistmentAsync::PrepareRequestDone.

If fSinglePhase flag is TRUE, it indicates that the RM is the only resource manager enlisted on the transaction. Therefore the resource manager has the option to perform the single phase optimization. If the RM does choose to perform the single phase optimization, then it lets the Transaction Coordinator know of this optimization by providing XACT_S_SINGLEPHASE flag to the ITransactionEnlistmentAsync::PrepareRequestDone. If the resource manager chooses not to perform the single phase optimization then the transaction manager will perform the second phase of the two-phase commit protocol.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in txcoord.h

See Also

ITransactionEnlistmentAsync