从 linq 关系中删除数据
如果我有一个如下所示的 sq-table 关系模型:
Project <----> ProjectActivity <----> Activity
其中 Project 和 Activity 通过 ProjectActivity 有多对多连接,并且我想删除 ProjectActivity (不仅仅是将其 Projekt FK 设置为 null)。我该怎么做?
如果我在 EntitySet 上采用 Project.ProjectActivities.Clear();
关系将被删除,但 ProjectActivity 行仍将存在,且对 Project 的引用为空。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该有效,你必须删除它们,而不仅仅是明确的关系
that should work, you have to delete them not just clear relations