public void CloseSessionOn(string sessionFactoryName)
        {
            ISession session = (ISession)ContextSessions[sessionFactoryName];

            try
            {
                if (session != null && session.IsOpen)
                {
                    session.Flush();
                }
            }
            catch
            { }
            finally
            {
                if (session != null && session.IsOpen)
                {
                    session.Clear();
                    session.Close();
                    session.Dispose();
                }
                ContextSessions[sessionFactoryName] = null;
                ContextSessions.Remove(sessionFactoryName);
            }
        }
        /// <summary>
        /// Flushes anything left in the session and closes the connection.
        /// </summary>
        public void CloseSessionOn(string sessionFactoryConfigPath)
        {
            ISession session = (ISession)ContextSessions[sessionFactoryConfigPath];

            if (session != null && session.IsOpen)
            {
                session.Flush();
                session.Close();
            }

            ContextSessions.Remove(sessionFactoryConfigPath);
        }
        /// <summary>
        /// Flushes anything left in the session and closes the connection.
        /// </summary>
        public void CloseSessionOn(string contextName)
        {
            ISession session = (ISession)ContextSessions[contextName];

            if (session != null && session.IsOpen)
            {
                session.Flush();
                session.Close();
            }

            ContextSessions.Remove(contextName);
        }
Beispiel #4
0
        /// <summary>
        /// Flushes anything left in the session and closes the connection.
        /// </summary>
        public void CloseSession(string sessionFactoryConfigPath)
        {
            ISession session = ContextSessions.ContainsKey(sessionFactoryConfigPath)
                         ? ContextSessions[sessionFactoryConfigPath]
                         : null;

            if (session != null && session.IsOpen)
            {
                session.Flush();
                session.Close();
            }

            ContextSessions.Remove(sessionFactoryConfigPath);
        }