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 got really confused when testing my
NHibernateUtil.IsInitialized(_myobject.MyCollection) line and it was false
but I saw a query retrieving the collection in Profiler...

until I realized that adding the collection to the Watch initializes it. The same happens if you open this collection in QuickWatch. :-p

Labels: ,