I have problem with deleting related rows in Entity Framework 4.1. I have tables with relations
Book 1<--->* BookFormats
I have set the on delete cascade
I use EF6 and this works.
var itemBinding = db.ItemBinding.Where(x => x.BindingToId == id) ; foreach (var ib in itemBinding) { db.Item.Remove(ib.Item); db.ItemBinding.Remove(ib); } db.SaveChanges();