System.Transactions.TransactionStatePromoted.PromotePhaseVolatiles C# (CSharp) Method

PromotePhaseVolatiles() protected method

protected PromotePhaseVolatiles ( InternalTransaction tx, VolatileEnlistmentSet &volatiles, bool phase0 ) : bool
tx InternalTransaction
volatiles VolatileEnlistmentSet
phase0 bool
return bool
        protected bool PromotePhaseVolatiles(
            InternalTransaction tx,
            ref VolatileEnlistmentSet volatiles,
            bool phase0)
        {
            if (volatiles._volatileEnlistmentCount + volatiles._dependentClones > 0)
            {
                if (phase0)
                {
                    // Create a volatile demultiplexer for the transaction
                    volatiles.VolatileDemux = new Phase0VolatileDemultiplexer(tx);
                }
                else
                {
                    // Create a volatile demultiplexer for the transaction
                    volatiles.VolatileDemux = new Phase1VolatileDemultiplexer(tx);
                }

                volatiles.VolatileDemux._promotedEnlistment = tx.PromotedTransaction.EnlistVolatile(volatiles.VolatileDemux,
                    phase0 ? EnlistmentOptions.EnlistDuringPrepareRequired : EnlistmentOptions.None);
            }

            return true;
        }