NHibernate:多对一 IUserType
继这个问题之后:
NHibernate: Lazy loading of IUserType
看来我不能延迟加载属性或一对一关系,有没有办法可以将 IUserType 与多对一结合使用?像这样的东西(不起作用):
<many-to-one
name="Client" column="`ClientId`"
lazy="true"
type="EmployeeSystem.UserTypes.ClientUserType, EmployeeSystem" />
Following on from this question:
NHibernate: Lazy loading of IUserType
Seeing as I can't lazy load a property or a one-to-one relationship, is there a way I can use an IUserType with a many-to-one? Something like this (which doesn't work):
<many-to-one
name="Client" column="`ClientId`"
lazy="true"
type="EmployeeSystem.UserTypes.ClientUserType, EmployeeSystem" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 NHibernate 不支持关联(多对一、一对一等)的自定义加载(
IUserType
)。附带说明一下,一对一延迟加载是可能的,但同样无法放置IUserType
挂钩。我认为您在惰性属性方面走在正确的轨道上。使用显示如何加载 Employee 的代码更新原始问题。Looks like NHibernate does not support custom loading (
IUserType
) for associations (many-to-one, one-to-one etc). As a side note, lazy loading with one-to-one is possible, but again there is no way to put theIUserType
hook. I think you were on the right track with lazy properties. Update the original question with the code that shows how you load Employee.