Example #1
0
 public static void ForceCloseSession()
 {
     if (session != null)
     {
         CurrentSession.Close();
         session = null;
     }
 }
Example #2
0
 /// <summary>
 /// Close current session
 /// </summary>
 public static void CloseSession()
 {
     _logger.Debug("Closing NHibernate session");
     if (CurrentSession != null)
     {
         CurrentSession.Close();
         CurrentSession = null;
     }
 }
Example #3
0
 public void CloseCurrentSession()
 {
     if (CurrentSession != null)
     {
         CurrentSession.Close();
         CurrentSession.Dispose();
         CurrentSession = null;
     }
 }
Example #4
0
 public static void ClearSession()
 {
     CurrentSession.Clear();
     CurrentSession.Close();
     CurrentSession.SessionFactory.Close();
     CurrentSession.Dispose();
     CurrentSession.SessionFactory.Dispose();
     mSession = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
Example #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;
     }
 }
Example #6
0
        public static void CloseSession()
        {
            if (session != null)
            {
                // CurrentSession.Disconnect();
                if (!ReuseSession)
                {
                    CurrentSession.Close();

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