I have a web app that uses the iBATIS.NET library.
The DAO is configured by using an XmlDocument, so the code is very similar to what they show in the documentation:
XmlDocument anXmlDoc = someSupportClass.GetDynamicXmlDocument();
DomDaoManagerBuilder builder = new DomDaoManagerBuilder();
builder.Configure(anXmlDoc);
The documentation says right below that:
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.
This does not appear to be true. In a threaded process, the following exception is thrown randomly:
WebSessionStore: Could not obtain reference to HttpContext at IBatisNet.DataAccess.SessionStore.WebSessionStore.ObtainSessionContext() at IBatisNet.DataAccess.SessionStore.WebSessionStore.get_LocalSession()
at IBatisNet.DataAccess.DaoManager.IsDaoSessionStarted() at IBatisNet.DataAccess.Configuration.DaoProxy.Intercept(IInvocation invocation, Object[] arguments)
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 HybridWebThreadSessionStore
(mentioned here).
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 DomDaoManagerBuilder
?