From 9de9777926bdbce9fad55bf27b943780b5e858a5 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Tue, 14 Jul 2026 16:41:18 +0200 Subject: [PATCH] Working at last! --- .../FinancialApi/ApplyFeeHandler.cs | 4 ++-- wolverine/a-frame-architecture/FinancialApi/Program.cs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wolverine/a-frame-architecture/FinancialApi/ApplyFeeHandler.cs b/wolverine/a-frame-architecture/FinancialApi/ApplyFeeHandler.cs index e249ece..358527e 100644 --- a/wolverine/a-frame-architecture/FinancialApi/ApplyFeeHandler.cs +++ b/wolverine/a-frame-architecture/FinancialApi/ApplyFeeHandler.cs @@ -10,10 +10,10 @@ public static class ApplyFeeHandler { public static Task LoadAsync( ApplyFeeCommand cmd, - AccountDbContext db) => db.Set().AsNoTracking().SingleOrDefaultAsync(x => x.Id == cmd.AccountId); + AccountDbContext db) => db.Accounts.AsNoTracking().SingleOrDefaultAsync(x => x.Id == cmd.AccountId); [Transactional] - public static (Update UpdatedAccount, FeeAppliedEvent Event) Handle( + public static (IStorageAction UpdatedAccount, FeeAppliedEvent Event) Handle( ApplyFeeCommand cmd, Account account) { diff --git a/wolverine/a-frame-architecture/FinancialApi/Program.cs b/wolverine/a-frame-architecture/FinancialApi/Program.cs index 4a512a0..f8f18ae 100644 --- a/wolverine/a-frame-architecture/FinancialApi/Program.cs +++ b/wolverine/a-frame-architecture/FinancialApi/Program.cs @@ -2,6 +2,7 @@ using FinancialApi; using FinancialApi.Infrastructure; using FinancialApi.ServiceDefaults; using JasperFx.CodeGeneration; +using JasperFx.Resources; using Microsoft.EntityFrameworkCore; using Wolverine; using Wolverine.EntityFrameworkCore; @@ -10,8 +11,10 @@ using Wolverine.Sqlite; var builder = WebApplication.CreateBuilder(args); +var connectionString = "Data Source=demo.db"; + builder.Services.AddDbContext(options => - options.UseSqlite("Data Source=demo.db")); + options.UseSqlite(connectionString)); // Add services to the container. // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi @@ -21,9 +24,12 @@ builder.AddServiceDefaults(); builder.Host.UseWolverine(opts => { - opts.PersistMessagesWithSqlite("Data Source=demo.db"); + opts.Discovery.IncludeAssembly(typeof(ApplyFeeHandler).Assembly); + opts.PersistMessagesWithSqlite(connectionString); opts.UseEntityFrameworkCoreTransactions(); + opts.Policies.AutoApplyTransactions(); }); +builder.Host.UseResourceSetupOnStartup(); var app = builder.Build();