开发者

NHibernate Property-ref linked property always lazy loads

开发者 https://www.devze.com 2022-12-20 04:18 出处:网络
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 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 settin开发者_开发技巧g 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?


It appears that this is a bug that has been fixed in 2.1GA. What version of NHibernate are you using?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号