2022-05-16 12:46:57 +02:00
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2022-06-08 08:53:44 +02:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-05-16 12:46:57 +02:00
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2022-06-08 08:53:44 +02:00
|
|
|
using Single_Page_Anwendung.Models;
|
2022-05-16 12:46:57 +02:00
|
|
|
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)
|
|
|
|
{
|
2022-06-08 08:53:44 +02:00
|
|
|
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<ILogger<Program>>();
|
|
|
|
logger.LogError(ex, "Fehler mit der Datenbank!");
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
host.Run();
|
2022-05-16 12:46:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
|
|
Host.CreateDefaultBuilder(args)
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
|
|
{
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|