/// <summary> /// Unregisters the unit of work. /// </summary> /// <param name="unitOfWork">The unit of work.</param> internal static void UnregisterUnitOfWork(UnitOfWork unitOfWork) { var stack = CurrentStack; if (stack.TopUnitOfWork == unitOfWork) { if (stack.TopTransaction != null) { throw new SessionException("Transaction is open! Try commit or rollback before "); } ClearStackInfo(stack); } }
/// <summary> /// Registers the unit of work. /// </summary> /// <param name="unitOfWork">The unit of work.</param> internal static void RegisterUnitOfWork(UnitOfWork unitOfWork) { var stack = CurrentStack; // if no session yet, start new if (stack.Session == null) { stack.TopUnitOfWork = unitOfWork; stack.Session = SessionFactoryInstance.OpenSession(); stack.Session.FlushMode = FlushMode.Commit; } }