using DataLayer; using DataLayer.Interfaces; using Deathwatch.Data; using Services; using Services.Interfaces; using Microsoft.EntityFrameworkCore; using Infrastructure; using Microsoft.Extensions.DependencyInjection; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(); builder.Services.AddDbContext(options => options.UseInMemoryDatabase("InMemoryDb")); builder.Services.AddTransient(typeof(IAbstractRepository<>), typeof(AbstractRepository<>)); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddHttpClient(); //builder.Services.AddSqlite("Data Source=deathwatch.db"); var currentDirectory = Directory.GetCurrentDirectory(); string folderPath = $"{currentDirectory}/XML/"; string outputJsonFilePath = $"{currentDirectory}/outputfile.json"; var app = builder.Build(); var scopeFactory = app.Services.GetRequiredService(); using (var scope = scopeFactory.CreateScope()) { var db = scope.ServiceProvider.GetRequiredService(); if (db.Database.EnsureCreated()) { DbContextInitializer.Initialize(db); } } // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); app.Run();