示例#1
0
 public static void ForceCloseSession()
 {
     if (session != null)
     {
         CurrentSession.Close();
         session = null;
     }
 }
示例#2
0
 /// <summary>
 /// Close current session
 /// </summary>
 public static void CloseSession()
 {
     _logger.Debug("Closing NHibernate session");
     if (CurrentSession != null)
     {
         CurrentSession.Close();
         CurrentSession = null;
     }
 }
示例#3
0
 public void CloseCurrentSession()
 {
     if (CurrentSession != null)
     {
         CurrentSession.Close();
         CurrentSession.Dispose();
         CurrentSession = null;
     }
 }
示例#4
0
 public static void ClearSession()
 {
     CurrentSession.Clear();
     CurrentSession.Close();
     CurrentSession.SessionFactory.Close();
     CurrentSession.Dispose();
     CurrentSession.SessionFactory.Dispose();
     mSession = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
示例#5
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && CurrentSession != null)
     {
         if (CurrentSession.IsOpen)
         {
             CurrentSession.Close();
         }
         CurrentSession.Dispose();
         _disposed = true;
     }
 }
示例#6
0
        public static void CloseSession()
        {
            if (session != null)
            {
                // CurrentSession.Disconnect();
                if (!ReuseSession)
                {
                    CurrentSession.Close();

                    session = null;
                }
            }
        }
 public void Disconnect()
 {
     CurrentSession.Close();
 }
示例#8
0
 /// <summary>
 /// 关闭会话
 /// </summary>
 public override void SessionClose() => CurrentSession.Close(true);
 /// <summary>
 /// 关闭当前会话
 /// </summary>
 public virtual void CloseSession()
 {
     CurrentSession.Close(true);
 }