示例#1
0
            private void NestedExpand(ExpandClause clause)
            {
                var nestedParser = new ExpandClauseParser(_parser, clause.NestedExpands);

                clause.NestedExpandParameter = Expression.Parameter(clause.ItemType);
                nestedParser.Parse(clause.NestedExpandParameter);
            }
示例#2
0
 private void InitializeExpand(HttpContext httpContext, ILogger logger,
                               ModelStateDictionary modelStateDictionary)
 {
     if (httpContext.Request.Query.TryGetValue("$expand", out var values))
     {
         var binder = httpContext.RequestServices.GetRequiredService <IOpenApiTypeHandler>();
         foreach (var value in values)
         {
             var parser = new ExpandClauseParser(binder, value, _expandClauses, modelStateDictionary);
             try
             {
                 parser.Parse(_parameter);
             }
             catch (Exception e)
             {
                 logger.LogError(e, "failed to parse $expand clause");
                 modelStateDictionary.TryAddModelException("$expand", e);
             }
         }
     }
 }