using System.Globalization; using Microsoft.AspNetCore.Localization; using Microsoft.Extensions.Options; using Microsoft.FluentUI.AspNetCore.Components; using Schaad.Accounting.Datasets; using Schaad.Accounting.UI.Components; namespace Schaad.Accounting.UI { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents() // The JSON editor sends whole data files (Transactions.json is several hundred KB) // from the browser; the default limit is 32 KB per message. .AddHubOptions(options => options.MaximumReceiveMessageSize = 8 * 1024 * 1024); builder.Services.AddFluentUIComponents(); builder.Services.Configure( builder.Configuration.GetSection("Settings")); builder.Services.AddSingleton(sp => sp.GetRequiredService>().Value); builder.Services.AddAccounting(); var app = builder.Build(); // 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(); var supportedCultures = new[] { new CultureInfo("de-CH") }; app.UseRequestLocalization(new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture(supportedCultures[0]), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures }); app.UseAntiforgery(); app.MapStaticAssets(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.Run(); } } }