Ejemplo n.º 1
0
        public void Build()
        {
            RegisterHealthCheckers();

            SillycoreAppBuilder.BeforeBuild(() =>
            {
                IWebHostBuilder webhostBuilder = SillycoreAppBuilder.DataStore.Get <IWebHostBuilder>(Constants.WebHostBuilder)
                                                 .UseStartup(_sillycoreStartup == null ? typeof(SillycoreStartup) : _sillycoreStartup);
                SillycoreAppBuilder.DataStore.Set(Constants.WebHostBuilder, webhostBuilder);
            });

            SillycoreApp app = SillycoreAppBuilder.Build();

            IServiceProvider serviceProvider         = app.DataStore.Get <IServiceProvider>(Sillycore.Constants.ServiceProvider);
            ILogger <SillycoreWebhostBuilder> logger = serviceProvider.GetService <ILogger <SillycoreWebhostBuilder> >();

            logger.LogInformation($"{_applicationName} started.");

            app.DataStore.Get <IWebHostBuilder>(Constants.WebHostBuilder).Build().Run();
        }
Ejemplo n.º 2
0
        public void Build()
        {
            SillycoreAppBuilder.DataStore.Set(Sillycore.Constants.UseShutDownDelay, true);
            RegisterHealthCheckers();

            IWebHost webHost = null;

            SillycoreAppBuilder.BeforeBuild(() =>
            {
                IWebHostBuilder webhostBuilder = SillycoreAppBuilder.DataStore.Get <IWebHostBuilder>(Constants.WebHostBuilder)
                                                 .UseStartup(typeof(SillycoreStartup));

                webHost = webhostBuilder
                          .Build();
            });

            SillycoreApp app = SillycoreAppBuilder.Build();
            ILogger <SillycoreWebhostBuilder> logger = app.ServiceProvider.GetService <ILoggerFactory>().CreateLogger <SillycoreWebhostBuilder>();

            logger.LogInformation($"{ApplicationName} started.");

            webHost.Run();
        }