using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using System; using Abstractions.Entities; namespace Server { public class AppDbContext(DbContextOptions options) : IdentityDbContext, long>(options) { public override DbSet Users { get; set; } public DbSet Cards { get; set; } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity() .HasMany(u => u.Cards) .WithOne(c => c.User) .HasForeignKey(c => c.UserId) .OnDelete(DeleteBehavior.Cascade); base.OnModelCreating(builder); } } }