Ejemplo n.º 1
0
        OnCreateQueryRequestAsync(HttpContext context)
        {
#if ASPNETCLASSIC
            IReadableStringCollection requestQuery = context.Request.Query;
#else
            IQueryCollection requestQuery = context.Request.Query;
#endif

            IQueryRequestBuilder builder =
                QueryRequestBuilder.New()
                .SetQuery(requestQuery[_queryIdentifier])
                .SetQueryName(requestQuery[_namedQueryIdentifier])
                .SetOperation(requestQuery[_operationNameIdentifier]);

            string variables = requestQuery[_variablesIdentifier];
            if (variables != null &&
                variables.Any() &&
                Utf8GraphQLRequestParser.ParseJson(variables)
                is IReadOnlyDictionary <string, object> v)
            {
                builder.SetVariableValues(v);
            }

            return(Task.FromResult(builder));
        }