private static IPromotableSinglePhaseNotification CreatePSPEEnlistment(
Guid promoterType,
byte[] promotedToken,
AutoResetEvent outcomeReceived,
bool nonMSDTC = true,
Transaction tx = null,
TransactionStatus spcResponse = TransactionStatus.Committed,
bool expectRejection = false,
bool comparePromotedToken = false,
bool failInitialize = false,
bool failPromote = false,
bool failSPC = false,
bool failGetPromoterType = false,
bool failGetId = false,
bool incorrectNotificationObjectToSetDistributedTransactionId = false
)
{
IPromotableSinglePhaseNotification enlistment = null;
Transaction txToEnlist = Transaction.Current;
if (tx != null)
{
txToEnlist = tx;
}
if (nonMSDTC)
{
NonMSDTCPromoterEnlistment nonMSDTCEnlistment = new NonMSDTCPromoterEnlistment(promoterType,
promotedToken,
outcomeReceived,
spcResponse,
failInitialize,
failPromote,
failSPC,
failGetPromoterType,
failGetId,
incorrectNotificationObjectToSetDistributedTransactionId);
if (nonMSDTCEnlistment.Enlist(txToEnlist, expectRejection, comparePromotedToken))
{
enlistment = nonMSDTCEnlistment;
}
TryProhibitedOperations(txToEnlist, promoterType);
}
else
{
throw new ApplicationException("normal PSPE not implemented yet.");
}
return enlistment;
}