public void CloseSession() { DMSession readSession = HttpContext.Current.Items[ReadCurrentSessionKey] as DMSession; if (readSession != null) { readSession.Close(); } DMSession session = HttpContext.Current.Items[CurrentSessionKey] as DMSession; if (session != null) { session.Close(); } }
internal DMSession GetSession(DbConntionType type = DbConntionType.WriteRead, string dbString = null) { if (type == DbConntionType.WriteRead) { if (_session == null) { _session = DMHelper.Instance._sessionfactory.BuildSession(type, dbString); } return(_session); } if (_readSession == null) { _readSession = DMHelper.Instance._sessionfactory.BuildSession(type, dbString); } return(_readSession); }
internal DMSession GetSession(DbConntionType type = DbConntionType.WriteRead, string dbString = null) { if (type == DbConntionType.WriteRead) { DMSession session = HttpContext.Current.Items[CurrentSessionKey + dbString] as DMSession; if (session == null) { session = _sessionfactory.BuildSession(type, dbString); HttpContext.Current.Items[CurrentSessionKey + dbString] = session; } return(session); } DMSession readSession = HttpContext.Current.Items[ReadCurrentSessionKey + dbString] as DMSession; if (readSession == null) { readSession = _sessionfactory.BuildSession(type, dbString); HttpContext.Current.Items[ReadCurrentSessionKey + dbString] = readSession; } return(readSession); }
/// <summary> /// 返回连接字符串 /// </summary> /// <param name="type"></param> /// <param name="dbString"></param> /// <returns></returns> public static string GetConnString(DbConntionType type = DbConntionType.WriteRead, string dbString = null) { DMSession session = DMHelper.Instance.GetSession(type, dbString); return(session.ConnectionString); }