Exemple #1
0
        /// <summary>
        /// sets the factory to transaction mode in which it remains until the returned object is disposed
        /// </summary>
        /// <returns></returns>
        internal LionDbContainerWithTransaction SetToTransactionMode()
        {
            if (myMode == Mode.Transaction)
            {
                throw new Exception("Already in transaction mode!");
            }

            try
            {
                myMode = Mode.Transaction;
                myCachedDbInConnection = InnerCreateWithTransaction();
                return(myCachedDbInConnection);
            }
            catch (Exception)
            {
                myMode = Mode.Normal;
                throw;
            }
        }
Exemple #2
0
 /// <summary>
 /// should only be called by a LionDbTransaction instance.
 /// disposes the cached database and transaction and setting the Factory back to normal/classic mode of all the time creating new instances when "Create" is called
 /// </summary>
 internal void ResetTransactionMode()
 {
     myCachedDbInConnection = null;              //we dont dispose, because this only gets called by the LionDbInTransaction.Dispose() method which already disposes the DB connection
     myMode = Mode.Normal;
 }
Exemple #3
0
 public NoDisposeTransactionContainer(LionDbContainerWithTransaction containerWithTransaction)
 {
     myContainerWithTransaction = containerWithTransaction;
 }