Beispiel #1
0
 /// <summary>
 /// Finalizes the request. If current session exists the method flushes it and
 /// closes. Call this method at the end of ASP.NET request.
 /// </summary>
 public static void EndRequest()
 {
     if (HasCurrent())
     {
         Close();
     }
     SessionSource.Set(null);
 }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }