Fluent NHibernate - 父子之间的单向映射
是否可以在父级加载时将引用传递给其子级,而无需从子级返回到父级的关系?
我不希望为此目的使用映射属性(即不希望为此目的使用双向关系)。
Is it possible to pass a reference at load time of a parent to it's children without a relationship back to the parent from the child?
I would prefer to NOT have a mapped property for this purpose (i.e. prefer not to use bi-directional relationships for this purpose).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能可以使用链接表来完成此操作,但是您必须通过代码强制执行一对多,否则它很容易变成多对多。链接表的要点是它保留父对象与其子对象之间的关联,而不是子对象本身。
You could probably do it with a linking table but you'd have to enforce one-to-many via code otherwise it could easily become a many-to-many. The jist of the linking table would be that it keeps the association between the parent and its children, rather than the child object itself.