EnlistmentOptions 列舉


判斷是否應該在準備階段登記物件。Determines whether the object should be enlisted during the prepare phase.

此列舉具有 FlagsAttribute 個屬性允許以位元方式合併其成員值。

public enum class EnlistmentOptions
public enum EnlistmentOptions
public enum EnlistmentOptions
type EnlistmentOptions = 
Public Enum EnlistmentOptions


EnlistDuringPrepareRequired 1

物件必須在認可程序的初始階段登記。The object must enlist during the initial phase of the commitment process.

None 0

在認可程序的初始階段,物件不需要登記。The object does not require enlistment during the initial phase of the commitment process.


此列舉會傳遞至 EnlistVolatile,並 EnlistDurable 和方法來通知交易管理員,資源管理員是否需要在準備階段期間建立另一個登記。This enumeration is passed into the EnlistVolatile and EnlistDurable and methods to notify the transaction manager whether the resource manager needs to create another enlistment during the Prepare phase. 如需登記的詳細資訊,請參閱將資源登記為交易中的參與者For more information on enlistment, see Enlisting Resources as Participants in a Transaction.

如果在登記期間指定 EnlistDuringPrepareRequired,資源管理員會指出它想要在交易仍允許新登記時收到準備通知。If EnlistDuringPrepareRequired is specified during enlistment, the resource manager indicates that it wants to receive a Prepare notification while new enlistments are still allowed for the transaction. 做為另一個持久性資源(例如後端資料庫)之快取的資源管理員,可能會在登記期間使用此選項。A resource manager who acts as a cache for another durable resource, such as a backend database, would probably use this option during enlistment. 當快取資源取得其準備通知時,它會將其內容傳輸至永久性資源。When the caching resource gets its Prepare notification, it transfers its content to the durable resource. 藉由這麼做,長期資源會在交易上登記,成為2階段認可(2PC)通訊協定的參與者。By doing so, the durable resource enlists on the transaction to become a participant of the 2 Phase Commit (2PC) protocol. 在這種情況下,只會登錄快取資源(而非持久資源)。Before this happens, only the caching resource (not the durable resource) was enlisted.

如果未指定,則登記會指出它將不會收到準備通知,直到在2PC 中建立新的登記為止。If None is specified, the enlistment indicates that it will not receive a Prepare notification until it is too late to create new enlistments in 2PC. 在先前的案例中,如果快取資源在登記期間指定此選項,並在準備通知期間嘗試排清其快取,則永久性資源會在嘗試登記時收到例外狀況,因為它太晚。In our preceding scenario, if a caching resource specifies this option during enlistment, and attempts to flush its cache during the Prepare notification, the durable resource gets an exception when it attempts on enlisting since it is too late.

[無] 應該做為預設值使用。None should be used as a default.