NHibernate - is property lazy loading possible?
Posted
by Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-06-01T14:52:53Z
Indexed on
2010/06/01
15:03 UTC
Read the original article
Hit count: 306
nhibernate
|lazy-loading
I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded.
However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible.
I have added the lazy="true" attribute to my property mapping but the field is still loaded from the database (I am using a simple text field to test).
My query:
return _session.CreateQuery("from Product")
.SetMaxResults(1)
.UniqueResult<Product>();
Mapping:
<property name="Description" type="string" column="FullDescription" lazy="true"/>
Has anyone been able to get this working? Personally I prefer this approach than having to add another table to my database.
© Stack Overflow or respective owner