AccountingNext/Schaad.Accounting.UI/Program.cs

47 lines
1.5 KiB
C#

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();
builder.Services.AddFluentUIComponents();
builder.Services.Configure<SettingsDataset>(
builder.Configuration.GetSection("Settings"));
builder.Services.AddSingleton(sp =>
sp.GetRequiredService<IOptions<SettingsDataset>>().Value);
builder.Services.AddRepositories().AddServices();
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();
app.UseAntiforgery();
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();
}
}
}