diff --git a/src/HotChocolate/Conventions/GraphqlConvention.cs b/src/HotChocolate/Conventions/GraphqlConvention.cs index e6fc12dc6..e797d5ba8 100644 --- a/src/HotChocolate/Conventions/GraphqlConvention.cs +++ b/src/HotChocolate/Conventions/GraphqlConvention.cs @@ -39,8 +39,8 @@ public GraphqlConvention( /// public void Register(IConventionContext context, IConfiguration configuration, IServiceCollection services) { - var sb = services - .AddGraphQL() + var sb = context + .GetOrAdd(() => services.AddGraphQL()) .AddFairyBread() .AddErrorFilter() .BindRuntimeType(); @@ -50,4 +50,4 @@ public void Register(IConventionContext context, IConfiguration configuration, I services.TryAddSingleton(_foundationOptions); sb.AddType(); } -} \ No newline at end of file +} diff --git a/src/HotChocolate/Conventions/HotChocolateConvention.cs b/src/HotChocolate/Conventions/HotChocolateConvention.cs index 287097cd1..91aafec82 100644 --- a/src/HotChocolate/Conventions/HotChocolateConvention.cs +++ b/src/HotChocolate/Conventions/HotChocolateConvention.cs @@ -28,9 +28,10 @@ public void Register(IConventionContext context, IConfiguration configuration, I dateTimeZoneProvider = new DateTimeZoneCache(context.Get()?.DateTimeZoneSource ?? TzdbDateTimeZoneSource.Default); services - .ConfigureOptions() - .AddGraphQL() + .ConfigureOptions(); + context + .GetOrAdd(() => services.AddGraphQL()) .ConfigureSchema(sb => sb.AddNodaTime(dateTimeZoneProvider)) .AddInstrumentation(); } -} \ No newline at end of file +}