0

Is there any way to define for 'cascade on update' but not 'on delete', something like this?

   modelBuilder.Entity<Payment>()
               .HasRequired(s => s.Customer)
               .WillCascadeOnDelete(false)
               .WillCascadeOnUpdate(true);
Efi_K
  • 43
  • 5

1 Answers1

0

You shouldn't want a foreignkey in a 1 to many relation to update. You are making a relation with that specific object and if the key changes it should mean that the object is different in such a way it requires a new key.

Tom Droste
  • 1,324
  • 10
  • 14