Exemple #1
0
        public async Task <IQueryResult> ExecuteAsync(
            IOperationContext operationContext,
            IImmutableDictionary <string, object?> scopedContext)
        {
            if (operationContext is null)
            {
                throw new ArgumentNullException(nameof(operationContext));
            }

            if (scopedContext is null)
            {
                throw new ArgumentNullException(nameof(scopedContext));
            }

            ISelectionSet rootSelections =
                operationContext.Operation.GetRootSelectionSet();

            ResultMap resultMap = rootSelections.EnqueueResolverTasks(
                operationContext, Path.Root, scopedContext,
                operationContext.RootValue);

            await ExecuteTasksAsync(operationContext).ConfigureAwait(false);

            return(operationContext
                   .TrySetNext()
                   .SetData(resultMap)
                   .BuildResult());
        }