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

前端 未结 4 1992
半阙折子戏
半阙折子戏 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条回答
  •  猫巷女王i
    2020-12-10 03:47

    I just dealt with this exact issue. It turned out that when I used EF to Update model from database... option, it didn't properly get the "Cascade" rule for on delete.

    Try going to your EF database model, click the association that is causing the problem, then make sure that the End1 OnDelete (could be End2, depends on database scheme) is set to Cascade.

提交回复
热议问题