|
3 | 3 | using System.Linq;
|
4 | 4 | using System.Threading;
|
5 | 5 | using System.Threading.Tasks;
|
| 6 | +using GraphQL.Execution; |
6 | 7 | using GraphQL.Types;
|
7 | 8 | using Microsoft.AspNetCore.Http;
|
8 | 9 | using Microsoft.Extensions.DependencyInjection;
|
@@ -92,14 +93,18 @@ await WriteErrorResponseAsync(httpResponse, writer,
|
92 | 93 | var schema = context.RequestServices.GetRequiredService<TSchema>();
|
93 | 94 |
|
94 | 95 | var results = await Task.WhenAll(
|
95 |
| - requests.Select(request => executer.ExecuteAsync(new ExecutionOptions |
| 96 | + requests.Select(request => executer.ExecuteAsync(options => |
96 | 97 | {
|
97 |
| - CancellationToken = context.RequestAborted, |
98 |
| - Schema = schema, |
99 |
| - Query = request.Query, |
100 |
| - OperationName = request.OperationName, |
101 |
| - Inputs = request.GetInputs(), |
102 |
| - UserContext = _options.UserContextFactory?.Invoke(context), |
| 98 | + options.CancellationToken = context.RequestAborted; |
| 99 | + options.Schema = schema; |
| 100 | + options.Query = request.Query; |
| 101 | + options.OperationName = request.OperationName; |
| 102 | + options.Inputs = request.GetInputs(); |
| 103 | + options.UserContext = _options.UserContextFactory?.Invoke(context); |
| 104 | + foreach (var listener in context.RequestServices.GetRequiredService<IEnumerable<IDocumentExecutionListener>>()) |
| 105 | + { |
| 106 | + options.Listeners.Add(listener); |
| 107 | + } |
103 | 108 | })));
|
104 | 109 |
|
105 | 110 | await WriteResponseAsync(context, writer, results);
|
|
0 commit comments