public static Microsoft.Extensions.Hosting.IHost MigrateDbContext <TContext>(this Microsoft.Extensions.Hosting.IHost webHost, Action <TContext, IServiceProvider> seeder) where TContext : DbContext
        {
            var underK8s = webHost.IsInKubernetes();

            using var scope = webHost.Services.CreateScope();
            TryMigrateAndSeed(scope, underK8s, seeder);

            return(webHost);
        }
        public Microsoft.Extensions.Hosting.IHostBuilder UseStartUp <T>()
        {
            System.Type startupType = typeof(T);

            this.m_hostServices.AddSingleton(typeof(IStartup), startupType);
            Microsoft.Extensions.Configuration.IConfiguration Configuration = this.m_configurationBuilder.Build();

            this.m_hostServices.Configure <Microsoft.Extensions.Configuration.IConfiguration>(Configuration);
            this.m_hostServices.AddSingleton <Microsoft.Extensions.Configuration.IConfiguration>(Configuration);


            System.IServiceProvider sp = this.m_hostServices.BuildServiceProvider();

            // Microsoft.Extensions.DependencyInjection.IServiceCollection services2 = Clone(this.m_hostServices);

            this.m_hostBuilder.ConfigureServices(
                (hostContext, services) =>
            {
                if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
                {
                    services.AddHostedService <LinuxServiceHost>();
                }
                else
                {
                    // Inject concrete implementation of the service
                    services.AddSingleton(typeof(System.ServiceProcess.ServiceBase), typeof(GenericService));
                }
            }
                );


            this.m_startup = sp.GetRequiredService <IStartup>();

            this.m_hostBuilder.ConfigureServices(
                (hostContext, services) =>
            {
                services.AddSingleton <IStartup>(this.m_startup);
            }
                );


            this.m_hostBuilder.ConfigureServices((hostContext, services) =>
            {
                this.m_startup.ConfigureServices(services);
            });

            this.m_host = this.m_hostBuilder.Build();

            this.m_applicationBuilder = new ApplicationBuilder(this.m_host.Services);
            this.m_startup.Configure(this.m_applicationBuilder);

            return(this);
        }
        public static bool IsInKubernetes(this Microsoft.Extensions.Hosting.IHost host)
        {
            var cfg = host.Services.GetService <IConfiguration>();

            return(CheckIfK8s(cfg));
        }
Example #4
0
 public static System.Threading.Tasks.Task WaitForShutdownAsync(this Microsoft.Extensions.Hosting.IHost host, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
 {
     throw null;
 }
Example #5
0
 public static void WaitForShutdown(this Microsoft.Extensions.Hosting.IHost host)
 {
 }
Example #6
0
 public static System.Threading.Tasks.Task StopAsync(this Microsoft.Extensions.Hosting.IHost host, System.TimeSpan timeout)
 {
     throw null;
 }
Example #7
0
 public static void Start(this Microsoft.Extensions.Hosting.IHost host)
 {
 }
Example #8
0
 public HostAdapter(Microsoft.Extensions.Hosting.IHost host, IDictionary <string, IComponent> components)
 {
     _host      = host;
     Components = new ReadOnlyDictionary <string, IComponent>(components);
 }
 public static Microsoft.AspNetCore.TestHost.TestServer GetTestServer(this Microsoft.Extensions.Hosting.IHost host)
 {
     throw null;
 }
 public static System.Net.Http.HttpClient GetTestClient(this Microsoft.Extensions.Hosting.IHost host)
 {
     throw null;
 }