internal override bool EnlistPromotableSinglePhase(
InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
Transaction atomicTransaction,
Guid promoterType
)
{
// Delegation will fail if there is a durable enlistment
if (tx._durableEnlistment != null)
{
return false;
}
TransactionStatePSPEOperation.PSPEInitialize(tx, promotableSinglePhaseNotification, promoterType);
// Create a durable enlistment.
Enlistment en = new Enlistment(tx, promotableSinglePhaseNotification, atomicTransaction);
tx._durableEnlistment = en.InternalEnlistment;
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.TransactionstateEnlist(tx._durableEnlistment.EnlistmentTraceId, EnlistmentType.PromotableSinglePhase, EnlistmentOptions.None);
}
// Specify the promoter for the transaction.
tx._promoter = promotableSinglePhaseNotification;
// Change the state that the transaction will promote to. Normally this would be simply
// be TransactionStatePromoted. However it now needs to promote to a delegated state.
// If the PromoterType is NOT TransactionInterop.PromoterTypeDtc, then the promoteState needs
// to be TransactionStateDelegatedNonMSDTC.
// tx.PromoterType was set in PSPEInitialize.
Debug.Assert(tx._promoterType != Guid.Empty, "InternalTransaction.PromoterType was not set in PSPEInitialize");
if (tx._promoterType == TransactionInterop.PromoterTypeDtc)
{
tx._promoteState = TransactionStateDelegated;
}
else
{
tx._promoteState = TransactionStateDelegatedNonMSDTC;
}
// Pud the enlistment in an active state
DurableEnlistmentState.DurableEnlistmentActive.EnterState(tx._durableEnlistment);
// Hand back the enlistment.
return true;
}