Error deleting a table row splitted on multiple entities

前端 未结 6 1009
耶瑟儿~
耶瑟儿~ 2021-01-06 05:18

I want to delete a table row that is split on two entities.

If I try to delete the main entity, I get an error if before I don\'t load the related other entity using

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-06 05:50

    I know this isn't the "correct" answer, but with all the hassle of getting table-splitting working and getting errors on deleting, I just went with a good old SQL command:

    DbContext.Database.ExecuteSqlCommand($"DELETE FROM Products WHERE Id = {id}");
    

    Always an option when you're spending hours trying to get a small feature working!

提交回复
热议问题