laatzen/LaaProductionWeb/LaaProductionWeb.Blazor/Program.cs
2025-04-01 14:10:35 +02:00

75 lines
2.7 KiB
C#

namespace LaaProductionWeb.Blazor
{
using LaaPackages.HeliumTester;
using LaaProductionWeb.Blazor.Components;
using LaaProductionWeb.Blazor.Components.CSD.Data;
using LaaProductionWeb.Blazor.Components.CSD.Models;
using LaaProductionWeb.Blazor.Components.HeliumTester.Models;
using LaaProductionWeb.Blazor.Components.Identity.Services;
using LaaProductionWeb.Blazor.Hubs;
using LaaProductionWeb.Blazor.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration;
var services = builder.Services;
services.AddDbContext<HeliumTesterDbContext>(options =>
{
var connectionString = configuration
.GetSection(nameof(ConnectionStrings))
.GetValue<string>(nameof(ConnectionStrings.Auftrag));
options.UseSqlServer(connectionString);
options.EnableDetailedErrors();
options.EnableSensitiveDataLogging();
});
services.AddScoped<IdentityService>();
services.AddScoped<IdentityJwtService>();
services.AddScoped<HeliumTesterService>();
services.AddScoped<MatchCollectionModel>();
services.AddScoped<RecipesCollectionModel>();
services.AddScoped<VAKOMerkmaleDbContext>();
services.AddScoped<VAKOMerkmaleModel>();
services.AddScoped<PcbRecipeModel>();
services.AddRazorComponents(options => options.DetailedErrors = true)
.AddInteractiveServerComponents(options => options.DetailedErrors = true);
services.AddAuthenticationCore();
services.AddAuthorizationCore();
services.AddSignalR();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseAntiforgery();
app.UseAuthentication();
app.UseAuthorization();
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode(options =>
{
options.DisableWebSocketCompression = true;
});
app.MapHub<ChangeHub>("/changes");
app.Run();
}
}
}