开发者

Remove data from linq relation

开发者 https://www.devze.com 2023-02-10 13:48 出处:网络
If i have a sq-table relation model开发者_如何转开发 that looks like this: Project <----> ProjectActivity <----> Activity

If i have a sq-table relation model开发者_如何转开发 that looks like this:

Project <----> ProjectActivity <----> Activity

Where Project and Activity has many to many connections via ProjectActivity and i want to remove a ProjectActivity (not just set its Projekt FK to null). How to i do this?

If I on the EntitySet takes Project.ProjectActivities.Clear(); the relation will be deletet but the ProjectActivity row will still be there with null reference to Project.


dataContext.ProjectActivities.DeleteAllOnSubmit(Project.ProjectActivities); 

that should work, you have to delete them not just clear relations

0

精彩评论

暂无评论...
验证码 换一张
取 消