using DXApp.TemplateKitProject.Data; using DXApp.TemplateKitProject.DevExpressExtensions; using DXApp.TemplateKitProject.Services; using Microsoft.EntityFrameworkCore; using DevExpress.AspNetCore; using DevExpress.AspNetCore.Reporting; using DevExpress.XtraReports.Web.Extensions; var builder = WebApplication.CreateBuilder(args); // MVC-Controller hinzufügen (benötigt für DevExpress WebDocumentViewer) builder.Services.AddControllersWithViews(); builder.Services.AddRazorPages(); // DevExpress Controls und Reporting Services builder.Services.AddDevExpressControls(); builder.Services.AddScoped(); // Datenbank var connectionString = builder.Configuration.GetConnectionString("EcmContext") ?? throw new InvalidOperationException("Connection string 'EcmContext' not found."); builder.Services.AddDbContext(options => options.UseSqlServer(connectionString)); // Services builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); var app = builder.Build(); if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseHttpsRedirection(); // MIME-Types für PDF.js UND DevExpress registrieren var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider(); provider.Mappings[".mjs"] = "text/javascript"; provider.Mappings[".ftl"] = "text/plain"; provider.Mappings[".woff2"] = "font/woff2"; provider.Mappings[".woff"] = "font/woff"; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); // DevExpress Middleware app.UseDevExpressControls(); app.UseRouting(); app.UseAuthorization(); // Controller-Routen verfügbar machen (wichtig für DevExpress WebDocumentViewer) app.MapControllers(); app.MapRazorPages(); app.Run();