public class YourEntity{ public int DEXID { get; set; } public int GRID{ get; set; } public bool BreedableState { get; set; } // Computed composite key public string CompKey => $"{DEXID}-{GRID}-{(BreedableState ? "t" : "f")}";}public class MyDbContext : DbContext{ public DbSet<YourEntity> Persons { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { // Configure the composite key modelBuilder.Entity<YourEntity>() .HasKey(p => p.CompKey); }}