/// <summary> /// Initialize a new instance of <see cref="FilterQueryOption"/> based on the raw $filter value and /// an EdmModel from <see cref="ODataQueryContext"/>. /// </summary> /// <param name="rawValue">The raw value for $filter query. It can be null or empty.</param> /// <param name="context">The <see cref="ODataQueryContext"/> which contains the <see cref="IEdmModel"/> and some type information</param> public FilterQueryOption(string rawValue, ODataQueryContext context) { if (context == null) { throw Error.ArgumentNull("context"); } if (String.IsNullOrEmpty(rawValue)) { throw Error.ArgumentNullOrEmpty("rawValue"); } Context = context; RawValue = rawValue; Validator = new FilterQueryValidator(); }
// This constructor is intended for unit testing only. internal FilterQueryOption(string rawValue, ODataQueryContext context) { if (context == null) { throw Error.ArgumentNull("context"); } if (String.IsNullOrEmpty(rawValue)) { throw Error.ArgumentNullOrEmpty("rawValue"); } Context = context; RawValue = rawValue; Validator = new FilterQueryValidator(); _queryOptionParser = new ODataQueryOptionParser( context.Model, context.ElementType, context.NavigationSource, new Dictionary<string, string> { { "$filter", rawValue } }); }
/// <summary> /// Initializes a new instance of the <see cref="SelectExpandQueryValidator" /> class based on /// the <see cref="DefaultQuerySettings" />. /// </summary> /// <param name="defaultQuerySettings">The <see cref="DefaultQuerySettings" />.</param> public SelectExpandQueryValidator(DefaultQuerySettings defaultQuerySettings) { _defaultQuerySettings = defaultQuerySettings; _filterQueryValidator = new FilterQueryValidator(_defaultQuerySettings); }