public virtual void ValidateQuery(HttpRequest request, IODataQueryOptions queryOptions) { if (request == null) { throw Error.ArgumentNull("request"); } if (queryOptions == null) { throw Error.ArgumentNull("queryOptions"); } IEnumerable <KeyValuePair <string, StringValues> > queryParameters = request.Query; foreach (KeyValuePair <string, StringValues> kvp in queryParameters) { if (!queryOptions.IsSupportedQueryOption(kvp.Key) && kvp.Key.StartsWith("$", StringComparison.Ordinal)) { // we don't support any custom query options that start with $ // this should be caught be OnActionExecuted(). throw new ArgumentOutOfRangeException(kvp.Key); } } queryOptions.Validate(_validationSettings); }
public virtual void ValidateQuery(HttpRequestMessage request, IODataQueryOptions queryOptions) { if (request == null) { throw Error.ArgumentNull("request"); } if (queryOptions == null) { throw Error.ArgumentNull("queryOptions"); } IEnumerable <KeyValuePair <string, string> > queryParameters = request.GetQueryNameValuePairs(); foreach (KeyValuePair <string, string> kvp in queryParameters) { if (!queryOptions.IsSupportedQueryOption(kvp.Key) && kvp.Key.StartsWith("$", StringComparison.Ordinal)) { // we don't support any custom query options that start with $ throw new HttpResponseException(request.CreateErrorResponse(HttpStatusCode.BadRequest, Error.Format(SRResources.QueryParameterNotSupported, kvp.Key))); } } queryOptions.Validate(_validationSettings); }