Monday, August 25, 2008

Adding an NHibernate collection to your QuickWatch initializes it

I spent most of the day trying to improve performance on an application. We use NHibernate 2.0 and try to lazy load most of the collections.
I found these two links very useful for troubleshooting my performance issue:
and the NHibernate reference:

The curious thing is I almost got really confused when testing my
NHibernateUtil.IsInitialized(_myobject.MyCollection) resulted in false
but I saw the query to retrieve the collection in Profiler...

until I realized, I had added this collection to the Watch, same happened if I opened this collection in QuickWatch...otherwise, the collection is indeed lazy loaded.

Labels: ,