NHibernate Property-ref 链接属性总是延迟加载
我的模型之一中有一个属性,它使用 property-ref 链接到非关键字段。它总是延迟加载,即使明确设置为不这样做。
我在同一个类中还有其他属性,它们使用普通方法(在其关键字段上)引用其他模型对象,并且这些属性注意到将延迟加载设置为 false 绝对没问题。
<many-to-one class="Company" lazy="false" name="Company" property-ref="Code">
<column name="CompanyCode" />
</many-to-one>
我将父模型加载到列表中并遇到经典的 N+1 问题,因为该字段是延迟加载的。这是 property-ref 属性的问题还是我错过了什么?
I have a property in one of my models that is linked to a non-key field using property-ref. It always lazy loads even though explicitly set to not do so.
I have other properties in the same class that reference other model objects using the normal method (on their key fields) and these take note of setting lazy load to false absolutely fine.
<many-to-one class="Company" lazy="false" name="Company" property-ref="Code">
<column name="CompanyCode" />
</many-to-one>
I'm loading the parent model into a list and getting the classic N+1 problem because this field is lazy loading. Is this an issue with property-ref properties or have I missed something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来这是一个错误,已在 2.1GA 中修复。您使用什么版本的 NHibernate?
It appears that this is a bug that has been fixed in 2.1GA. What version of NHibernate are you using?