nHibernate 映射问题 - 无法删除集合的成员

发布于 2024-07-16 12:52:57 字数 291 浏览 3 评论 0原文

好的。 所以情况是:

父类有一个子类的 IDictionary。 我希望当父类删除时这些子类也被删除。 这很好用。 我还希望能够单独删除子类的成员,但这不起作用。

所以我的问题是; 为什么我无法删除这些子成员?

我得到的错误是这样的:

无法删除,会级联读取

我的父类中的映射文件具有“all-delete-orphan”的级联设置,而子类没有定义级联。

任何想法? 干杯。

Ok. So the situation is:

Parent Class which has an IDictionary of Child Classes. I wish these child classes to be deleted when the parent class is. This works fine. I also wish to be able to delete members of the child class individually, and this does NOT work.

So my Question is; Why can I not delete these child members?

The error I get is along the lines of:

Cannot delete, Would be readded by cascade

My mapping file in the parent class has a cascade setting of 'all-delete-orphan' while the child class has no cascading defined.

Any idea? Cheers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙沙粒小 2024-07-23 12:52:57

查看映射会很有帮助。 但我的猜测是,除了删除子项之外,您还没有从父项的集合中删除子项。

It would be helpful to see the mappings. But my guess is that you are not removing the child from the parent's collection in addition to deleting it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文