Add Domain project and shifted handlers to application.

This commit is contained in:
2026-07-15 16:10:00 +02:00
parent 656f545281
commit 0376b58a33
16 changed files with 229 additions and 52 deletions
@@ -1,4 +1,5 @@
using FinancialApi;
using FinancialApi.Application;
using FinancialApi.Infrastructure;
using FinancialApi.ServiceDefaults;
using JasperFx.CodeGeneration;
@@ -11,11 +12,16 @@ using Wolverine.Sqlite;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddExceptionHandler<DomainExceptionHandler>();
builder.Services.AddProblemDetails();
var connectionString = "Data Source=demo.db";
builder.Services.AddDbContext<AccountDbContext>(options =>
options.UseSqlite(connectionString));
builder.Services.AddScoped<IAccountQuery, AccountQuery>();
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
@@ -33,6 +39,8 @@ builder.Host.UseResourceSetupOnStartup();
var app = builder.Build();
app.UseExceptionHandler();
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<AccountDbContext>();