I want to take a snapshot of an instance of an entity and therefore I want to force all proxies to load for this instance.
I don't want to disable lazy loading for 开发者_JAVA百科the majority of the time I just wondering if there is an API I can call to force all proxies to be loaded.
Well there is a utility function NHibernateUtil.Initialize(object)
which is not recursive if i remember correctly. With the help of NHibernateUtil.IsInitialized(object)
you can create a method of your own that loads all proxies in an oject
There is a lazy initializer for NHibernate on codeproject that should be able to accomplish this.
精彩评论