Looking for some help with Entity Framework cascade delete. We initially had cascade delete disable globally
modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
We are now wanting to re enable it. However the problem comes that when creating the migration we get this error "may cause cycles or multiple cascade paths".
The solution of using the fluent API works create..
modelBuilder.Entity<Campus>()
.HasRequired(c => c.Institution)
.WithMany()
.WillCascadeOnDelete(false);
However Institution causes more than one problem as the InstitutionId is everywhere. I want to avoid having to go through every option and ignore them case by case. Is it possible to stop cascade delete for all the relationships on the Institution table?
Institution's never get deleted so we don't mind if there isn't a cascade delete on that.
Thanks