Working at last!
This commit is contained in:
@@ -10,10 +10,10 @@ public static class ApplyFeeHandler
|
||||
{
|
||||
public static Task<Account?> LoadAsync(
|
||||
ApplyFeeCommand cmd,
|
||||
AccountDbContext db) => db.Set<Account>().AsNoTracking().SingleOrDefaultAsync(x => x.Id == cmd.AccountId);
|
||||
AccountDbContext db) => db.Accounts.AsNoTracking().SingleOrDefaultAsync(x => x.Id == cmd.AccountId);
|
||||
|
||||
[Transactional]
|
||||
public static (Update<Account> UpdatedAccount, FeeAppliedEvent Event) Handle(
|
||||
public static (IStorageAction<Account> UpdatedAccount, FeeAppliedEvent Event) Handle(
|
||||
ApplyFeeCommand cmd,
|
||||
Account account)
|
||||
{
|
||||
|
||||
@@ -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<AccountDbContext>(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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user