Esempio n. 1
0
        /// <summary>
        /// Flushes current session.
        /// </summary>
        public static void Flush()
        {
            ISession session = SessionSource.Get();

            if (session != null)
            {
                session.Flush();
            }
        }
Esempio n. 2
0
        /// <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);
            }
        }
Esempio n. 3
0
        /// <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);
            }
        }
Esempio n. 4
0
 /// <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);
 }