Problem with cascade delete using Entity Framework and System.Data.SQLite

前端 未结 4 1982
半阙折子戏
半阙折子戏 2020-12-10 02:44

I have a SQLite DB that is set up so when I delete a Person the delete is cascaded. This works fine when I manually delete a Person (all records that reference the PersonID

4条回答
  •  执念已碎
    2020-12-10 03:25

    I was having the same problem with SQL Server. When I tried to update mode from database, it didn't pick up the cascade rules. Note that the rules were added after the model was already created. I even tried deleting a table from the model and adding it back in. That had the same effect - no cascade rules.

    However, when I created a brand new model with the same exact tables, it picked up the cascade rules. So my solution was just to delete the old model and create a new one with the same name, etc.

    I guess is that there is something wrong with the update model from database process.

提交回复
热议问题