using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Single_Page_Anwendung.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Aps_Single_Page_Anwendung { public class Program { public static void Main(string[] args) { var host = CreateHostBuilder(args).Build(); using(var scope = host.Services.CreateScope()) { var service = scope.ServiceProvider; try { DatenEinlesen.Initialize(service); } catch (Exception ex) { var logger = service.GetRequiredService>(); logger.LogError(ex, "Fehler mit der Datenbank!"); throw; } } host.Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } }