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.
OpenSession SessionFactoryImpl. , ( ), . settings.CacheProvider.NextTimestamp() sessionLocalInterceptor.SetSession(session); -, OpenSession.
settings.CacheProvider.NextTimestamp()
sessionLocalInterceptor.SetSession(session);
, , .Dispose/. .
Source: https://habr.com/ru/post/1786742/More articles:Check the status of antivirus in C # - c #Google Fonts: How can I prevent Internet Explorer from displaying bold as normal? - cssHow to access server side clip attachments? - ruby-on-railstype function () - c #any open source C / C ++ RTMP streaming server? - c ++Mobile user interfaces and other user interface scripts - jquery-mobileJavascript validation in Django admin - javascriptThe most effective way to count clicks - javascriptGroup for X days - mysqlAttempting to access select function from Oracle with PHP - functionAll Articles