/// <summary> /// Flushes current session. /// </summary> public static void Flush() { ISession session = SessionSource.Get(); if (session != null) { session.Flush(); } }
/// <summary> /// Flushes and closes current session. /// </summary> public static void CloseAndFlush() { ISession session = SessionSource.Get(); if (session != null) { session.Flush(); session.Close(); SessionSource.Set(null); } }
/// <summary> /// Closes current session. /// </summary> /// <remarks><b>N.B.</b> Close do not flush the session.</remarks> public static void Close() { ISession session = SessionSource.Get(); if (session != null) { session.Close(); session.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); SessionSource.Set(null); } }
/// <summary> /// Tells if we currently have a session object or not. /// </summary> /// <returns><b>true</b> if there is a current session and <b>false</b> otherwise.</returns> private static bool HasCurrent() { return(SessionSource.Get() != null); }