Exemple #1
0
        internal void Initialize(QueryExpressionParser parser, ModelStateDictionary modelState)
        {
            var selectParser = new SelectClauseParser(parser);

            try
            {
                SelectClause = selectParser.Parse(Parameter);
            }
            catch (Exception e)
            {
                modelState.TryAddModelException(QueryOptionKeys.OrderbyKeys.First(), e);
            }
        }
Exemple #2
0
 private void InitializeSelect(HttpContext httpContext, ILogger logger,
                               ModelStateDictionary modelStateDictionary)
 {
     if (httpContext.Request.Query.TryGetValue("$select", out var values))
     {
         var binder = httpContext.RequestServices.GetRequiredService <IOpenApiTypeHandler>();
         foreach (var value in values)
         {
             var parser = new SelectClauseParser(binder, value);
             try
             {
                 RootSelectClause = parser.Parse(_parameter);
             }
             catch (Exception e)
             {
                 logger.LogError(e, "failed to parse $select clause");
                 modelStateDictionary.TryAddModelException("$select", e);
             }
         }
     }
 }