简体   繁体   English

NHibernate:多对一IUserType

[英]NHibernate: Many-to-one IUserType

Following on from this question: 接下来是这个问题:

NHibernate: Lazy loading of IUserType NHibernate:延迟加载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? 看到我无法延迟加载属性或一对一关系,有没有办法可以将IUserType与多对一配合使用? 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). 看起来NHibernate不支持自定义加载( IUserType )的关联(多对一,一对一等)。 As a side note, lazy loading with one-to-one is possible , but again there is no way to put the IUserType hook. 作为一个侧面说明,延迟加载一个对一个可能 ,但是又没有办法把IUserType钩。 I think you were on the right track with lazy properties. 我认为您在使用惰性属性方面正处于正确的轨道上。 Update the original question with the code that shows how you load Employee. 使用显示如何加载Employee的代码更新原始问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM