Convert Trafag exporter to Blazor Server app with UI and scheduler

This commit is contained in:
2026-04-09 15:52:23 +02:00
parent 8d8b62f1f5
commit ec14b838e5
25 changed files with 1438 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore;
using MudBlazor.Services;
using TrafagSalesExporter.Data;
using TrafagSalesExporter.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddMudServices();
builder.Services.AddDbContextFactory<AppDbContext>(options =>
options.UseSqlite("Data Source=trafag_exporter.db"));
builder.Services.AddScoped<CryptoService>();
builder.Services.AddScoped<HanaQueryService>();
builder.Services.AddScoped<ExcelExportService>();
builder.Services.AddScoped<SharePointUploadService>();
builder.Services.AddScoped<ExportOrchestrationService>();
builder.Services.AddHostedService<TimerBackgroundService>();
var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
var dbFactory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<AppDbContext>>();
var cryptoService = scope.ServiceProvider.GetRequiredService<CryptoService>();
await using var db = await dbFactory.CreateDbContextAsync();
await db.Database.EnsureCreatedAsync();
await DbInitializer.SeedDefaultsAsync(db, cryptoService);
}
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<TrafagSalesExporter.Components.App>()
.AddInteractiveServerRenderMode();
app.Run();