diff --git a/src/VirtoCommerce.Xapi.Core/Extensions/ApplicationBuilderExtensions.cs b/src/VirtoCommerce.Xapi.Core/Extensions/ApplicationBuilderExtensions.cs index c352258..cd4fde7 100644 --- a/src/VirtoCommerce.Xapi.Core/Extensions/ApplicationBuilderExtensions.cs +++ b/src/VirtoCommerce.Xapi.Core/Extensions/ApplicationBuilderExtensions.cs @@ -1,11 +1,22 @@ using GraphQL.Server.Ui.Playground; using GraphQL.Types; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using VirtoCommerce.Xapi.Core.Infrastructure; +using VirtoCommerce.Xapi.Core.Models; namespace VirtoCommerce.Xapi.Core.Extensions; public static class ApplicationBuilderExtensions { + public static IApplicationBuilder UseScopedSchema(this IApplicationBuilder builder, string schemaPath) + { + var playgroundOptions = builder.ApplicationServices.GetService>(); + + return builder.UseSchemaGraphQL>(playgroundOptions?.Value?.Enable ?? true, schemaPath); + } + public static IApplicationBuilder UseSchemaGraphQL(this IApplicationBuilder builder, bool schemaIntrospectionEnabled = true, string schemaPath = null) where TSchema : ISchema {