流畅的 nhibernate 映射问题:多对多自连接附加数据
我正在努力处理以下 sql 表的映射
|Post | |PostRelation |
|------------------| |-----------------|
|PostId |1--------*|ParentPostId |
|---other stuff--- |1--------*|ChildPostId |
| | |RelationType |
理想情况下,我喜欢帖子上名为 relatedPosts as 的属性
Dictionary <RelationType,IList<Post>>
但此刻我只是满足于帖子上的属性
IList<PostRelation>.
我成功地使用了多对多来获取相关帖子,但此方法丢失了附加数据。
有什么建议吗?
I am struggling with mappings for the following sql tables
|Post | |PostRelation |
|------------------| |-----------------|
|PostId |1--------*|ParentPostId |
|---other stuff--- |1--------*|ChildPostId |
| | |RelationType |
Ideally Id like a property on post called relatedPosts as
Dictionary <RelationType,IList<Post>>
But at the minute Id just settle for a property on post with an
IList<PostRelation>.
I successfully used a many to many to get related posts, but this method loses the addtional data.
Any suggestions??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过大量研究,我终于找到了解决方案。因此,尽管我会发布它,以防它将来可以帮助其他人。
由于 PostRelation 有附加数据,因此它本身需要成为一个实体。
---PostRelationMap
---PostMap
I Finally found a solution after much research. So though I would post it in case it can help anyone else in the future.
As PostRelation had additional data, it needed to be an entity in its own right.
---PostRelationMap
---PostMap