using Microsoft.EntityFrameworkCore; using UserManagement.Domain.Entities; namespace UserManagement.Infrastructure { public class ApplicationDbContext : DbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet Users { get; set; } public DbSet Roles { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity() .HasOne(u => u.Role) .WithMany() .HasForeignKey(u => u.RoleId); } } }