Conflict with reference constraint in TPT code-first Entity Framework

.net c# entity-framework entity-framework-6

Accepted Answer

You must first explicitly include your navigation property in the query. then for some reasonRemoveRange cascading delete doesn't function as planned, but if you iterate and remove each one individually, it does.

var products = Set<SpecialProduct>().Include(p => p.MyProperties).ToList();
products.ForEach(p => AllProducts.Remove(p));
SaveChanges();
1
8/15/2018 10:53:13 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow