Removing all records from navigation properties in Entity Framework

后端 未结 3 691
时光取名叫无心
时光取名叫无心 2021-01-05 13:57

I have 1:N relationship between Program and Student tables which EF converted into navigation property. Now I want to delete all those records in this navigation students. I

3条回答
  •  离开以前
    2021-01-05 14:22

    I really don't know if it's gonna work or not, but I can not help it, I'm curious. Is program.Students.Clear() working? Or maybe reset it, reinitializing it? I hope it helped you...

    Edit: Please use @Ladislav Mrnka's response, as that is the correct one. I have tried to remove the answer but I cannot because it's the accepted one

提交回复
热议问题