NHibernate:多对一的IUserType [英] NHibernate: Many-to-one IUserType
问题描述
接下来是这个问题:
看到我不能懒加载一个属性或一对一的关系,有没有办法我可以使用一个多对一的IUserType?像这样(不起作用):
<多对一
name =Client column =`ClientId`
lazy =true
type =EmployeeSystem.UserTypes.ClientUserType,EmployeeSystem/>
看起来NHibernate不支持自定义加载( IUserType
)用于关联(多对一,一对一等)。作为一个侧面说明,延迟加载与一对一的是可能的,但是又无法将 IUserType
挂钩。我认为你在懒惰属性的正确轨道上。使用显示如何加载Employee的代码更新原始问题。
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" />
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 the IUserType
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.
这篇关于NHibernate:多对一的IUserType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!