Пример #1
0
        public static IWebHost BuildWebHost(string[] args)
        {
            var host = WebHost.CreateDefaultBuilder(args)
                       .UseConfiguration(new ConfigurationBuilder()
                                         .AddCommandLine(args)
                                         .Build())
                       .UseStartup <Startup>()
                       .Build();

            using var scope = host.Services.CreateScope();

            var services = scope.ServiceProvider;
            var context  = services.GetRequiredService <MandoContext>();

            DemoData.Seed(services);

            return(host);
        }