Fluent nHibernate 映射引用的另一侧
我有一个类似于下面的表结构:
AttributeKey (ID, Title)
AttributeValue (ID, AttributeKeyID, Value)
我已经完成了所有映射设置,以便如果我查询 AttributeValue,它会使用引用连接到 AttributeKey (AttributeValue.AttributeKeyID = AttributeKey.ID),没问题...但是,我想查询 AttributeKey 表并 LEFT JOIN 到 AttributeValue 表,以便获得所有 AttributeKey 以及与它们关联的任何值...如何在流畅的 nHibernate 中映射它?
本质上它是引用映射的逆过程。
编辑:我知道 HasMany 方法与引用相反,但使用该方法会引发异常,即我的属性未实现 UserCollectionType
干杯
I've got a table structure similar to the below:
AttributeKey (ID, Title)
AttributeValue (ID, AttributeKeyID, Value)
I've got my mapping all setup so that if I query AttributeValue, it joins to AttributeKey (AttributeValue.AttributeKeyID = AttributeKey.ID) using References, no problem... however, I want to query the AttributeKey table and LEFT JOIN onto the AttributeValue table so that I get all AttributeKeys and any values ascociated to them... how do I map this in fluent nHibernate?
Essentially it's the reverse of a References mapping.
EDIT: I'm aware that the HasMany method is meant to be the reverse of References but using that throws the exception that my property doesn't implement UserCollectionType
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该是 AttributeKey ClassMap 中的 HasMany。您的类应该如下所示:
然后您的映射将如下所示:
This should be a HasMany in your AttributeKey ClassMap. Your class should look something like this:
Your mapping would then look like this: