Exemplo n.º 1
0
        public static IStitchingBuilder AddSchemaFromLocal(this IStitchingBuilder stitchingBuilder,
                                                           string serviceName, ISchemaBuilder schemaBuilder, IWebHostEnvironment env, IServiceCollection services)
        {
            var schemaName = $"AG_{serviceName}";

            stitchingBuilder.AddQueryExecutor(schemaName, sp => schemaBuilder.AddServices(sp).Create().MakeExecutable());

            // Add extensions (for types that get stitched in from this service)
            stitchingBuilder.AddExtensionsFromFileForService(serviceName, env);

            return(stitchingBuilder);
        }
Exemplo n.º 2
0
        public static IStitchingBuilder AddSchemaFromHttp(this IStitchingBuilder stitchingBuilder,
                                                          string serviceName, IWebHostEnvironment env, IConfiguration config, IServiceCollection services)
        {
            var clientName = $"{serviceName}Client";
            var schemaName = $"AG_{serviceName}";

            // Register named HTTP client with schema name
            services.AddGraphQLClient(schemaName, config[$"{clientName}ApiUrl"]);

            // Add schema by using same schema name
            stitchingBuilder.AddSchemaFromHttp(schemaName);

            // Add extensions (for types that get stitched in from this service)
            stitchingBuilder.AddExtensionsFromFileForService(serviceName, env);

            return(stitchingBuilder);
        }