Reputation: 22940
I have an web application that uses NHibernate as ORM. I enable lazy loading for my classes but I want to load some classes without lazy in a special situation.
Now is there any utility or built in class in NHibernate that force a class to load it without lazy in a special situation?
Note: I don't want to remove lazy property in my mapping file, because I use lazy loading in some of time.
Upvotes: 1
Views: 184
Reputation: 17657
You might try looking at your system in different light.
http://www.infoq.com/presentations/Making-Roles-Explicit-Udi-Dahan
Upvotes: 0
Reputation: 3806
Yes. If you are using the ICriteria Api to specify your queries, you can use SetFetchmode
to specify eager loading for some of the properties on a per-query basis.
I did a blog post on wrapping the behavior in a query object, it may be useful.
Upvotes: 2