Can I selectively turn off lazy-loading w/NHibernate? -


with linq sql, can specify, given fetch, don't want specific child elements loaded (eagerly or lazily). possible in nhibernate? there times when want root object and/or part of object graph, , i'd able specify rather having write dto , mapping around fact nhibernate feels compelled load if try serialize object.

thanks!

yes, but…

the level of flexibility have here may depend on version of nhibernate , how building query. example, linq query (here versioning may make difference) not going give same flexibility icriteria or hql query.

with criteria api, can call .setfetchmode(), passing in property , desired mode query.

nhibernate allows create projections, can instantiate objects of unmapped types or dtos without mapping. of course, projection goes one-way; if isn't mapped, can't persisted.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -