3

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 the majority of the time I just wondering if there is an API I can call to force all proxies to be loaded.

AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152

2 Answers2

3

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

Jaguar
  • 5,929
  • 34
  • 48
2

There is a lazy initializer for NHibernate on codeproject that should be able to accomplish this.

DanP
  • 6,310
  • 4
  • 40
  • 68