开发者

Remove data from linq relation

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜