From f9169889c43f5385a07f3ca28fc58b2b32dd4068 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 8 Sep 2020 13:17:50 +0200 Subject: [PATCH] Shared executor. --- .../Contents/GraphQL/GraphQLModel.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs index f9272bcd4..7bcd837bc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs @@ -26,6 +26,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL { public sealed class GraphQLModel : IGraphModel { + private static readonly IDocumentExecuter Executor = new DocumentExecuter(); private readonly Dictionary contentTypes = new Dictionary(); private readonly PartitionResolver partitionResolver; private readonly IGraphType assetType; @@ -125,7 +126,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL { Guard.NotNull(context, nameof(context)); - var result = await new DocumentExecuter().ExecuteAsync(execution => + var result = await Executor.ExecuteAsync(execution => { context.Setup(execution); @@ -134,7 +135,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL execution.Query = query.Query; }).ConfigureAwait(false); - return (result.Data, result.Errors?.Select(x => (object)new { x.Message, x.Locations }).ToArray()); + var errors = result.Errors?.Select(x => (object)new { x.Message, x.Locations }).ToArray(); + + return (result.Data, errors); } } }