I have a Nhibernate Class Library and a Web App that references it. I can get data form the Product table and It’s fine, but when I refresh it, I receive this issue.Please see image below:
http://vi-vn.com/pubs/images/NhibernateWeb.jpg (Dead Link)
Is there a way to correct his issue?
The error message images you have linked indicate to me that you are probably attempting to access a session after it has already been closed. This commonly occurs when trying to access lazy-loaded collections/references. For example:
NHibernate sees that the MyObjects collection is lazy-loaded and has not been initialized yet, so it tries to query for the collection via the session that it is associated with. However, that session is already closed so it throws an
ObjectDisposedExceptionand says “Session is closed!”The solution is to either pre-load your collection or make sure the session does not go out of scope or is explicitly disposed before you are done with it.