public OperationExecuter( ISchema schema, DocumentNode queryDocument, OperationDefinitionNode operation) { _schema = schema ?? throw new ArgumentNullException(nameof(schema)); _queryDocument = queryDocument ?? throw new ArgumentNullException(nameof(queryDocument)); _operation = operation ?? throw new ArgumentNullException(nameof(operation)); _executionTimeout = schema.Options.ExecutionTimeout; _variableValueBuilder = new VariableValueBuilder(schema, _operation); if (!_executionStrategy.TryGetValue(_operation.Operation, out IExecutionStrategy strategy)) { throw new NotSupportedException(); } _strategy = strategy; var directiveCollector = new DirectiveCollector(_schema); directiveCollector.VisitDocument(_queryDocument); _directiveLookup = directiveCollector.CreateLookup(); }
private DirectiveLookup CreateLookup( ISchema schema, DocumentNode document) { var directiveCollector = new DirectiveCollector(schema); directiveCollector.VisitDocument(document); return(directiveCollector.CreateLookup()); }
private DirectiveLookup GetOrCreateDirectiveLookup( IQueryContext context) { return(_directiveCache.GetOrCreate( context.Request.Query, () => { var directiveCollector = new DirectiveCollector( context.Schema); directiveCollector.VisitDocument(context.Document); return directiveCollector.CreateLookup(); })); }