using Lutra.Application.Interfaces; using Lutra.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace Lutra.Infrastructure.Sql; public class LutraDbContext : DbContext, ILutraDbContext { public LutraDbContext(DbContextOptions options) : base(options) { } public DbSet Supermarkten => Set(); public DbSet Verspaketten => Set(); protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity() .ToTable("Beoordelingen"); modelBuilder.Entity() .HasMany(v => v.Beoordelingen) .WithOne() .HasForeignKey(b => b.VerspakketId) .IsRequired(); } public override Task SaveChangesAsync(CancellationToken cancellationToken = default) { return base.SaveChangesAsync(cancellationToken); } }