NHibernate ObjectDisposedException Session Object

In any case, to check if the NHibernate session has been deleted?

I have a wrapper class in a session that has its own implementation of Finalizer and IDispoable, however, if the session is deleted before I process it myself in my class, I get an ObjectDisposedException.

I really don't want my cleansing code to be

try {
...
}
catch (ObjectDisposedException) { }

But I am not sure of anything else. The Session.IsOpen and Session.IsActive properties do not seem to provide any reliable information so that I can confirm that the session has been deleted.

For a complete source, you can view it on Assembla .

+3
source share
3 answers

, . , , End() dispose , , , . End() , , , . , , , , . , , .

+1

, NHibernate " ", , "".

using(Session session = new Session())
{
}

/. , ISession impl, IsAlreadyDisposed(), . , , " " .

. "Session.Is(). InTransaction()" Session- > Transaction, . .

0

" , , . "

, , ?. , , nhibernate , , ?

0
source

Source: https://habr.com/ru/post/1702659/


All Articles