Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I notice that you mentioned from your other question/answer:</p> <pre><code>SqlConnection class is not thread-safe, and that includes closing the connection on a separate thread. Based on this response we have filed a bug report for NHibernate. </code></pre> <p>However, from <A href="http://nhforge.org/doc/nh/en/index.html#transactions-basics" rel="nofollow noreferrer">NHibernate's documentation</a>:</p> <pre><code>11.2. Threads and connections </code></pre> <p><strong>You should observe the following practices when creating NHibernate Sessions:</strong></p> <p><li>Never create more than one concurrent ISession or ITransaction instance per database connection.</p> <p><li>Be extremely careful when creating more than one ISession per database per transaction. The ISession itself keeps track of updates made to loaded objects, so a different ISession might see stale data.</p> <p><li>The ISession is not threadsafe! Never access the same ISession in two concurrent threads. An ISession is usually only a single unit-of-work!</p> <p>If you are trying to multi-thread the connection with NHibernate perhaps it is just not going to work. Have you considered a different ORM such as <a href="http://msdn.microsoft.com/en-US/data/ef" rel="nofollow noreferrer">Entity Framework</a>?</p> <p>No matter what ORM you choose though, the database connection will not be thread safe. This is universal. </p> <p>"many DB drivers are not thread safe. Using a singleton means that if you have many threads, they will all share the same connection. The singleton pattern does not give you thread saftey. It merely allows many threads to easily share a "global" instance." - <a href="https://stackoverflow.com/a/6507820/1026459">https://stackoverflow.com/a/6507820/1026459</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload