public void OpenSession() { ISession session = GetNewSession(); ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); sessionStorageContainer.Store(session); }
public void Close() { ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); ISession currentSession = sessionStorageContainer.GetCurrentSession(); currentSession.Close(); }
public static ISessionStorageContainer GetStorageContainer() { if (sessionStorageContainer == null) { sessionStorageContainer = new HttpSessionContainer(); } return sessionStorageContainer; }
public static ISessionStorageContainer GetStorageContainer() { if (NhSessionStorageContainer == null) { if (HttpContext.Current != null) NhSessionStorageContainer = new HttpSessionContainer(); } return NhSessionStorageContainer; }
public static ISessionStorageContainer GetStorageContainer() { if (_nhSessionStorageContainer == null) { if (HttpContext.Current == null) _nhSessionStorageContainer = new ThreadSessionStorageContainer(); else _nhSessionStorageContainer = new HttpSessionContainer(); } return _nhSessionStorageContainer; }
public static ISessionStorageContainer <IT> GetStorageContainer() { if (_nhSessionStorageContainer == null) { if (HttpContext.Current != null) { _nhSessionStorageContainer = new HttpSessionContainer <IT>(_sessionKey); } } return(_nhSessionStorageContainer); }
public ISession GetCurrentSession() { ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); ISession currentSession = sessionStorageContainer.GetCurrentSession(); if (currentSession == null) { currentSession = GetNewSession(); sessionStorageContainer.Store(currentSession); } return(currentSession); }
public static ISessionStorageContainer GetStorageContainer() { if (_nhSessionStorageContainer == null) { //if (HttpContext.Current == null) // _nhSessionStorageContainer = new ThreadSessionStorageContainer(); //else _nhSessionStorageContainer = new HttpSessionStorageContainer(); } return(_nhSessionStorageContainer); }
public void CloseSession() { ISession session = GetCurrentSession(); if (session != null && session.IsOpen) { //session.Flush(); session.Close(); } ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); sessionStorageContainer.Store(null); }
public static ISession GetCurrentSession(string dbName) { ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); ISession currentSession = sessionStorageContainer.GetCurrentSession(dbName); if (currentSession == null) { currentSession = GetNewSession(dbName); sessionStorageContainer.Store(dbName, currentSession); } return(currentSession); }
public static ISessionStorageContainer GetStorageContainer() { if (_sessionStorageContainer == null) { if (HttpContext.Current == null) { _sessionStorageContainer = new ThreadSessionStorageContainer(); } else { _sessionStorageContainer = new HttpSessionContainer(); } } return(_sessionStorageContainer); }
public static ISession GetCurrentSession(Web.IHttpContextAccessor context) { ISessionStorageContainer sessionStorageContainer = SessionStorageFactory.GetStorageContainer(context); ISession currentSession = sessionStorageContainer.GetCurrentSession(); if (currentSession == null) { currentSession = GetNewSession(); sessionStorageContainer.Store(currentSession); } return(currentSession); }
public static ISessionStorageContainer GetStorageContainer(IHttpContextAccessor context) { if (_nhSessionStorageContainer == null) { if (context.HttpContext == null) { _nhSessionStorageContainer = new ThreadSessionStorageContainer(); } else { _nhSessionStorageContainer = new HttpSessionContainer(context); } } return(_nhSessionStorageContainer); }
/// <summary> /// 获取当前的会话 /// </summary> /// <returns></returns> public static ISession GetCurrentSession() { //获取贮藏容器 ISessionStorageContainer _sessionStorageContainer = SessionStorageFactory.GetStorageContainer(); //每个实现的贮藏容器获得当前的 ISession currentSession = _sessionStorageContainer.GetCurrentSession(); if (currentSession == null) { //获取当前贮藏中的会话(需打开OpenSession) currentSession = GetNewSession(); //贮藏容器执行存储当前会话的操作 _sessionStorageContainer.Store(currentSession); } return(currentSession); }
public static ISessionStorageContainer GetStorageContainer(string key) { ISessionStorageContainer storageContainer = _nhSessionStorageContainer.ContainsKey(key) ? _nhSessionStorageContainer[key] : null; if (storageContainer == null) { if (HttpContext.Current == null) { storageContainer = new ThreadSessionStorageContainer(key); _nhSessionStorageContainer.Add(key, storageContainer); } else { storageContainer = new HttpSessionContainer(key); _nhSessionStorageContainer.Add(key, storageContainer); } } return(storageContainer); }
public static ISessionStorageContainer GetStorageContainer() { _nhSessionStorageContainer = new ThreadSessionContainer(); return _nhSessionStorageContainer; }
public SessionFactory(IConfigurationBuilder configurationBuilder, ISessionStorageContainer sessionStorageContainer) { _configurationBuilder = configurationBuilder; _sessionStorageContainer = sessionStorageContainer; }
public static ISessionStorageContainer GetStorageContainer() { _nhSessionStorageContainer = new ThreadSessionContainer(); return(_nhSessionStorageContainer); }
public SessionStorageFactory(ISessionStorageContainer nhSessionStorageContainer) { _nhSessionStorageContainer = nhSessionStorageContainer; }