I\'ve been wrestling with this for a while and can\'t quite figure out what\'s happening. I have a Card entity which contains Sides (usually 2) - and both Cards and Sides h
Here's what I did. This will apply to all Circular relationships, hence you don't have to specify one by one inside OnModelCreating.
Steps
var cascadeFKs = modelBuilder.Model.GetEntityTypes()
.SelectMany(t => t.GetForeignKeys())
.Where(fk => !fk.IsOwnership && fk.DeleteBehavior == DeleteBehavior.Cascade);
foreach (var fk in cascadeFKs)
fk.DeleteBehavior = DeleteBehavior.Restrict;
This did the trick for me.