예제 #1
0
        /// <summary>
        /// Enlists in the specified transaction.
        /// </summary>
        /// <param name="transaction">
        /// A reference to an existing <see cref="System.Transactions.Transaction"/> in which to enlist.
        /// </param>
        public override void EnlistTransaction(System.Transactions.Transaction transaction)
        {
            if (currentTransaction != null)
            {
                if (currentTransaction.BaseTransaction == transaction)
                {
                    return;
                }

                throw new MySqlException("Already enlisted");
            }

            currentTransaction = new MySqlPromotableTransaction(this, transaction);
            transaction.EnlistPromotableSinglePhase(currentTransaction);
        }
예제 #2
0
        /// <summary>
        /// Enlists in the specified transaction.
        /// </summary>
        /// <param name="transaction">
        /// A reference to an existing <see cref="System.Transactions.Transaction"/> in which to enlist.
        /// </param>
        public override void EnlistTransaction(System.Transactions.Transaction transaction)
        {
            // if the transaction given to us is null, then there is nothing to do.
            if (transaction == null)
            {
                return;
            }

            if (currentTransaction != null)
            {
                if (currentTransaction.BaseTransaction == transaction)
                {
                    return;
                }

                throw new MySqlException("Already enlisted");
            }

            MySqlPromotableTransaction t = new MySqlPromotableTransaction(this, transaction);

            transaction.EnlistPromotableSinglePhase(t);
            currentTransaction = t;
        }