Has anybody noticed that "current_session_context_class" in nHibernate doesn't properly handle "thread"?
The problem is with the following code, which appears to want a specific class name, and not a more generic "thread" string value:
Code:
private ICurrentSessionContext BuildCurrentSessionContext()
{
string impl = properties[Cfg.Environment.CurrentSessionContextClass] as string;
if (impl == null)
{
return null;
}
try
{
System.Type implClass = ReflectHelper.ClassForName(impl);
return (ICurrentSessionContext) Activator.CreateInstance(implClass, new object[]{this});
}
catch (Exception e)
{
log.Error("Unable to construct current session context [" + impl + "]", e);
return null;
}
}
I did a little sleuthing and found no classes that implement ICurrentSessionContext either... am I missing something here?
Basically I'm working with an ASP.Net application, and yes, I know you could build an NHibernateUtil or NHibernateHttpModule to build a session per request, but I'm trying to keep my class library from having a dependency on System.WEb and also trying to keep the ASP.Net app from "knowing" how to configure Data access...
In a lot of hibernate documentation, this "thread" setting is the same as building a session per request, so it would be helpful to either have this work like the Java hibernate.
In all honesty, I would love to contribute some thoughts and code to the project to address this
Thanks!
E.Newton