NHibernate:多对一的IUserType [英] NHibernate: Many-to-one IUserType

查看:174
本文介绍了NHibernate:多对一的IUserType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

接下来是这个问题:

NHibernate:延迟加载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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆