79244684

Date: 2024-12-02 15:47:39
Score: 0.5
Natty:
Report link

If you use FluentAPI, you can do something similar to this. I think it's more challenging with Data Annotations. You may have to write custom SQL for it.

{
    modelBuilder.Entity<DerivedFoo>()
        .HasMany(p => p.User)
        .OnDelete(DeleteBehavior.Restrict);  // This turns off cascade delete
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kevin UI