Friday 29 September 2017

NHibernate serializing lazy-loaded entities

You can't lazy-load a collection after you've closed the NHibernate.ISession object from which it was loaded. The only options you have are:
  1. Keep the ISession open until you've serialized the data.
  2. Turn off lazy loading.
  3. make sure you fetch all the lazy loaded collections before closing the session.
  4. use Not.LazyLoad()

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive