Added a-frame-architecture usiung wolverine sample.

This commit is contained in:
2026-08-03 17:08:18 +02:00
parent 1b5bf4f8d4
commit 61fe59cf83
72 changed files with 3012 additions and 0 deletions
@@ -0,0 +1,42 @@
using FinancialApi.Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace FinancialApi.Infrastructure;
public class AccountDbContext(DbContextOptions<AccountDbContext> options) : DbContext(options)
{
public DbSet<Account> Accounts => Set<Account>();
public DbSet<BalancedJournalEntry> JournalEntries => Set<BalancedJournalEntry>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Account>()
.HasKey(x => x.Id);
modelBuilder.Entity<Account>()
.HasData(
new Account(1, 10000000.00m, AccountType.Borrow),
new Account(2, 50000000.00m, AccountType.Spend),
new Account(99999, 0.00m, AccountType.Revenue)
);
modelBuilder.Entity<BalancedJournalEntry>(builder =>
{
builder.HasKey(x => x.Id);
builder.OwnsMany(
x => x.Lines,
line =>
{
line.WithOwner()
.HasForeignKey("JournalEntryId");
line.Property<int>("Id")
.ValueGeneratedOnAdd();
line.HasKey("Id");
line.Property(x => x.Type)
.HasConversion<string>();
}
);
}
);
}
}