private static MyEnlistment CreateVolatileEnlistment(
AutoResetEvent outcomeReceived,
Transaction tx = null,
EnlistmentOptions options = EnlistmentOptions.None,
bool votePrepared = true)
{
MyEnlistment enlistment = new MyEnlistment(outcomeReceived, votePrepared);
Transaction txToEnlist = Transaction.Current;
if (tx != null)
{
txToEnlist = tx;
}
txToEnlist.EnlistVolatile(enlistment, options);
return enlistment;
}