/// <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; } }
/// <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; }
public NoDisposeTransactionContainer(LionDbContainerWithTransaction containerWithTransaction) { myContainerWithTransaction = containerWithTransaction; }