using GerbilManagerWebAPI.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; public class ApplicationContext : DbContext { public ApplicationContext(DbContextOptions options) : base(options) { } public DbSet Gerbils { get; set; } public DbSet Litters { get; set; } public DbSet Breeders { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasOne(entity => entity.Litter); modelBuilder.Entity().HasOne(entity => entity.Father); modelBuilder.Entity().HasOne(entity => entity.Mother); modelBuilder .Entity() .Property(d => d.Gender) .HasConversion(new EnumToStringConverter()); } }