Is NHibernate SessionFactory thread safe

According to the documentation, SessionFactory should be thread safe:

ISessionFactory is thread safe, many threads can access it at the same time and request ISessions.

I am looking at an implementation and I cannot understand how, for example, OpenSession () can be thread safe:

http://nhibernate.svn.sourceforge.net/viewvc/nhibernate/trunk/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs?revision=5233&view=markup

There are several lock () calls, but nothing was found in OpenSession (). All the safe lock-free implementations that I could find were mostly single.

+3
source share
1 answer

OpenSession SessionFactoryImpl. , ( ), . settings.CacheProvider.NextTimestamp() sessionLocalInterceptor.SetSession(session); -, OpenSession.

, , .Dispose/. .

+2

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


All Articles