Browse Source

Shared executor.

pull/575/head
Sebastian 5 years ago
parent
commit
f9169889c4
  1. 7
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs

7
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 public sealed class GraphQLModel : IGraphModel
{ {
private static readonly IDocumentExecuter Executor = new DocumentExecuter();
private readonly Dictionary<Guid, ContentGraphType> contentTypes = new Dictionary<Guid, ContentGraphType>(); private readonly Dictionary<Guid, ContentGraphType> contentTypes = new Dictionary<Guid, ContentGraphType>();
private readonly PartitionResolver partitionResolver; private readonly PartitionResolver partitionResolver;
private readonly IGraphType assetType; private readonly IGraphType assetType;
@ -125,7 +126,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
{ {
Guard.NotNull(context, nameof(context)); Guard.NotNull(context, nameof(context));
var result = await new DocumentExecuter().ExecuteAsync(execution => var result = await Executor.ExecuteAsync(execution =>
{ {
context.Setup(execution); context.Setup(execution);
@ -134,7 +135,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
execution.Query = query.Query; execution.Query = query.Query;
}).ConfigureAwait(false); }).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);
} }
} }
} }

Loading…
Cancel
Save