Esempio n. 1
0
        /// <summary>
        /// Initiates a nested transaction.
        /// </summary>
        /// <returns>The nested <see cref="Transaction" />.</returns>
        /// <exception cref="TransactionException">Thrown if the transaction is not open.</exception>
        /// <exception cref="TransactionException">Thrown if the transaction is not on the top of the stack.</exception>
        public Transaction BeginTransaction()
        {
            using (TimedLock.Lock(syncLock))
            {
                if (!isOpen)
                {
                    throw new TransactionException(NotOpenMsg);
                }

                if (transBase.Count == 0 || !object.ReferenceEquals(this, transBase.Peek()))
                {
                    throw new TransactionException("This transaction is not on the top of the stack.");
                }

                return(transBase.BeginTransaction());
            }
        }