共用方式為


IResourceManager2::Enlist2

 

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 Enlist2 method enlists a resource manager in a transaction and returns an XID that can be used to query the outcome of the transaction during recovery.

Syntax

  
      HRESULT Enlist2( ITransaction * pTransaction,  
  ITransactionResourceAsync * pRes,  
  XACTUOW * pUOW,  
  LONG * pisoLevel,  
  XID * pxid,ITransactionEnlistmentAsync ** ppEnlist  
);  

Parameters

pTransaction
[in] Pointer to the transaction object in which the resource manager wants to enlist.

pRes
[in] Pointer to the resource manager's ITransactionResourceAsync interface. The resource manager developer must implement the methods on this interface.

pUOW
[out] Pointer to the transaction identifier GUID.

pisoLevel
[out] Pointer to the value of the client specified isolation level.

pxid
[out] A pointer to the XID structure that contains the transaction identifier of the transaction.

ppEnlist
[out] Reference to the ITransactionEnlistmentAsync interface on the enlistment object.

Return Values

S_OK
Success.

E_INVALIDARG
One or more parameters were invalid.

E_OUTOFMEMORY
Unable to allocate memory.

E_UNEXPECTED
Something unexpected happened.

XACT_E_ABORT
The transaction has aborted.

XACT_E_CONNECTION_DOWN
Lost connection with the transaction manager.

XACT_E_NOTRANSACTION
For some reason, the transaction could not be found. Perhaps it was not exported, or it could have been aborted and forgotten before the enlist call was made.

XACT_E_LOGFULL
Unable to enlist as the LOG is full.

XACT_E_TOOMANY_ENLISTMENTS
The coordinator already has the maximum number of resources enlisted in the transaction and is unable to enlist any more. The maximum number of resources that can be enlisted in a transaction is 32. Typically, coordinators should not have an arbitrary limit as to the maximum number of enlistments they can support.

Remarks

An instance of ITransactionResourceAsync is passed as an argument. This interface is implemented by the resource manager, and there is an instance of it per transaction. If the coordinator is successful in enlisting the resource manager on the requested transaction, the resource manager then receives an instance of ITransactionEnlistmentAsync as an out parameter to the Enlist method.

It is important to remember that an ITransaction instance is being provided to the method as in argument. However, the transaction in the general case would have been begun by the application. The resource manager somehow needs to obtain that transaction from the client before it can request to be enlisted in it. In brief, the application calls a function or invokes a method in the resource manager proxy, asking it to enlist in the transaction. The resource manager proxy, with the help of DTC proxy, is then responsible for propagating the transaction to the resource manager server.

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 txdtc.h

See Also

IResourceManager