📅  最后修改于: 2022-03-11 14:49:21.434000             🧑  作者: Mango
public class FoodJournalEntities : DbContext
{
public DbSet Journals { get; set; }
public DbSet JournalEntries { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity()
.HasOptional(j => j.JournalEntries)
.WithMany()
.WillCascadeOnDelete(true);
base.OnModelCreating(modelBuilder);
}
}