如何通过连接表映射一对多关系?
我将如何在 NHibernate 中映射以下内容?
我的实体和 ERD 如下。我知道如何映射多对多关系,但不知道如何将连接表 ReportTargets 映射到 Datapoint 表。您会注意到没有 ReportTargets 实体模型,因为它严格来说不是域实体。这里最好的解决方案是什么?我是 NHibernate 新手,所以请轻松一点..:) 谢谢
How would I go about mapping the following in NHibernate?
My entities and ERD are below. I know how to map a many-many relationship, but dont know how to map the joining table ReportTargets to the Datapoint table. You will notice that there is no ReportTargets entity model as it is not strictly a domain entity. What is the best solution here? I am a NHibernate newbie so go easy please..:) Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 MarketReport.Targets 有一个连接表,因此将其映射为多对多。
根据您最近的评论,您想要一个 三元关联,或组件集合。我已经包含了这两个映射。
As MarketReport.Targets has a join table, map it as many-to-many.
Based on your most recent comment, you want either want a ternary association, or a component collection. I have included both mappings.