EF通过导航属性取出从表的集合后,无法删除子表

主从表是配了级联删除的,如果通过导航属性去除从表明细删除时将报错The relationship could not be changed because one or more of the foreign-key properties is non-nullable

通过实体导航属性取出来的从表集合,EF无法判断你是否要对其进行别的操作,不会级联删除,必须手动删除从表记录

猜你喜欢

转载自www.cnblogs.com/Cyril-hcj/p/11697701.html