using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace BlazingPizza.Server { public class Program { public static void Main(string[] args) { var host = CreateHostBuilder(args).Build(); // Initialize the database var scopeFactory = host.Services.GetRequiredService(); using (var scope = scopeFactory.CreateScope()) { var db = scope.ServiceProvider.GetRequiredService(); if (db.Database.EnsureCreated()) { SeedData.Initialize(db); } } host.Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } }