コード例 #1
0
ファイル: Session.cs プロジェクト: qwdf1615/sncore
        /// <summary>
        /// Flushes current session.
        /// </summary>
        public static void Flush()
        {
            ISession session = SessionSource.Get();

            if (session != null)
            {
                session.Flush();
            }
        }
コード例 #2
0
ファイル: Session.cs プロジェクト: qwdf1615/sncore
        /// <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);
            }
        }
コード例 #3
0
ファイル: Session.cs プロジェクト: qwdf1615/sncore
        /// <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);
            }
        }
コード例 #4
0
ファイル: Session.cs プロジェクト: qwdf1615/sncore
 /// <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);
 }