Ejemplo n.º 1
0
        public void OpenSession()
        {
            ISession session = GetNewSession();
            ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer();

            sessionStorageContainer.Store(session);
        }
Ejemplo n.º 2
0
        public ISession GetCurrentSession()
        {
            ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer();
            ISession currentSession = sessionStorageContainer.GetCurrentSession();

            if (currentSession == null)
            {
                currentSession = GetNewSession();
                sessionStorageContainer.Store(currentSession);
            }
            return(currentSession);
        }
Ejemplo n.º 3
0
        public void CloseSession()
        {
            ISession session = GetCurrentSession();

            if (session != null && session.IsOpen)
            {
                session.Flush();
                session.Close();
                session.Dispose();
            }
            ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer();

            sessionStorageContainer.Store(null);
        }