Exemplo n.º 1
0
        public void QueryExecutorOptions(
            SchemaCreation creation,
            string executorName)
        {
            // arrange
            IHttpClientFactory clientFactory = CreateRemoteSchemas();

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(clientFactory);

            // act
            serviceCollection.AddStitchedSchema(b => b
                                                .AddSchemaFromHttp("contract")
                                                .SetSchemaCreation(creation));

            // assert
            IServiceProvider services =
                serviceCollection.BuildServiceProvider();

            IQueryExecutor executor = services
                                      .GetRequiredService <IQueryExecutor>();

            Assert.Equal(executorName, executor.GetType().Name);
        }
Exemplo n.º 2
0
        public static async Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var connection = scope.ServiceProvider.GetRequiredService <IConfiguration>()
                                 .GetConnectionString("postgres");

                var schema = new SchemaCreation(connection);
                await schema.CreateTable(CancellationToken.None);
            }
            await host.RunAsync();
        }
Exemplo n.º 3
0
 public IStitchingBuilder SetSchemaCreation(SchemaCreation creation)
 {
     _buildOnFirstRequest = creation == SchemaCreation.OnFirstRequest;
     return(this);
 }
 public IStitchingBuilder SetSchemaCreation(SchemaCreation creation)
 {
     throw new NotImplementedException();
 }