/// <summary> /// Apply query culture to current thread. /// </summary> /// <param name="query"> /// The session query containing the culture /// </param> public static void ApplyCultureToThread(SessionQuery query) { if (query != null && query.CurrentCulture != null) { Thread.CurrentThread.CurrentUICulture = query.CurrentCulture; } }
public static SessionQuery SaveSessionQuery(HttpSessionState session, SessionQuery query) { if (session == null) { throw new ArgumentNullException("session"); } session[Constants.HTTPSessionQueryAttr] = query; return(query); }
/// <summary> /// Retrieves the query saved into specified HTTP session. /// </summary> /// <param name="session"> /// the HTTP session /// </param> /// <returns> /// the query instance, which will never be <c>null</c> if the method succeeds /// </returns> public static SessionQuery GetSessionQuery(HttpSessionStateBase session) { if (session == null) { throw new ArgumentNullException("session"); } SessionQuery query = (SessionQuery)session[Constants.HTTPSessionQueryAttr]; //getting EndpointType NSIClientSettings settings = NSIClientSettings.Instance; //EndpointType endPointType = (EndpointType)Enum.Parse(typeof(EndpointType), settings.EndPointType); //query.EndPointType = Enum.IsDefined(typeof(EndpointType), endPointType) ? endPointType : EndpointType.V20; ApplyCultureToThread(query); // if (query == null) // { // throw new ArgumentException("No query instance found into HTTP session"); // } return(query); }
public static SessionQuery SaveSessionQuery(HttpSessionState session, SessionQuery query) { if (session == null) { throw new ArgumentNullException("session"); } session[Constants.HTTPSessionQueryAttr] = query; return query; }