20 lines
553 B
C#
20 lines
553 B
C#
using FinancialApi.Application;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FinancialApi.Infrastructure;
|
|
|
|
public class AccountDbContext(DbContextOptions<AccountDbContext> options) : DbContext(options)
|
|
{
|
|
public DbSet<Account> Accounts => Set<Account>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<Account>()
|
|
.HasKey(x => x.Id);
|
|
|
|
modelBuilder.Entity<Account>().HasData(
|
|
new Account(1, 100.00m),
|
|
new Account(2, 500.00m)
|
|
);
|
|
}
|
|
} |