title: iBATIS.NET WebSessionStore throwing an exception
body: <p>I have a web app that uses the iBATIS.NET library.</p>
  
  <p>The DAO is configured by using an XmlDocument, so the code is very similar to what they show in the documentation:</p>
  
  <pre><code>XmlDocument anXmlDoc = someSupportClass.GetDynamicXmlDocument();
  DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
  builder.Configure(anXmlDoc);
  </code></pre>
  
  <p>The documentation says right below that:</p>
  
  <blockquote>
    <p>The DaoManager instance that is built from a dao.config file is aware
    of all of the contexts contained within the configuration file. The
    context basically bundles DAO implementations together with a session
    handler. The DaoManager knows which DAOs and session handler belong to
    which context. When you request a DAO instance from the DaoManager,
    the proper session handler will be provided with it. Therefore, there
    is no need to access the context or session handler directly. Your DAO
    knows how it works.</p>
  </blockquote>
  
  <p>This does not appear to be true. In a threaded process, the following exception is thrown randomly:</p>
  
  <blockquote>
    <p>WebSessionStore: Could not obtain reference to HttpContext    at
    IBatisNet.DataAccess.SessionStore.WebSessionStore.ObtainSessionContext()
    at
    IBatisNet.DataAccess.SessionStore.WebSessionStore.get_LocalSession()<br>
    at IBatisNet.DataAccess.DaoManager.IsDaoSessionStarted()    at
    IBatisNet.DataAccess.Configuration.DaoProxy.Intercept(IInvocation
    invocation, Object[] arguments)</p>
  </blockquote>
  
  <p>The application may run fine for days or even months at a time, but every once in awhile this exception is thrown. The only solution I can find mentioned anywhere is to swap out the SessionStore for a <code>HybridWebThreadSessionStore</code> (<a href="https://issues.apache.org/jira/browse/IBATISNET-279" rel="nofollow">mentioned here</a>).</p>
  
  <p>As the documentation says above, this shouldn't be necessary. If I wanted to force it though, how would I go about overriding the SessionStore created by the <code>DomDaoManagerBuilder</code>?</p>