Beispiel #1
0
    ResolveFieldContext ResolveFieldContext(
        MyDataContext ctx,
        CancellationToken token,
        Document document,
        ISchema schema)
    {
        var operation        = document.Operations.FirstOrDefault();
        var variableValues   = ExecutionHelper.GetVariableValues(document, schema, operation?.Variables, null);
        var executionContext = new ExecutionContext
        {
            Document                  = document,
            Schema                    = schema,
            UserContext               = ctx,
            Variables                 = variableValues,
            Fragments                 = document.Fragments,
            CancellationToken         = token,
            Listeners                 = new IDocumentExecutionListener[0],
            Operation                 = operation,
            ThrowOnUnhandledException = true // DEBUG
        };

        var operationRootType = ExecutionHelper.GetOperationRootType(
            executionContext.Document,
            executionContext.Schema,
            executionContext.Operation);

        var node = ExecutionStrategy.BuildExecutionRootNode(executionContext, operationRootType);

        return(GetContext(executionContext, node.SubFields["companies"]));
    }