Entity Framework cascading delete problems - Foreign key set to null

冷暖自知 提交于 2019-12-06 09:24:21

The cascade delete in the EDMX will only cascade loaded (attached) entities. so unless your entity is loaded it is not going to cascade the delete. EF is expecting your db to cascade the delete.

  1. Make sure you have a cascade delete set up in your database
  2. Set the cascade delete in your EDMX
  3. If you can't do 1, make sure you load all entities before deleting
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!