开发者

Force all nhibernate proxies to be load for an instance

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜