Hi!
I am trying to figure out where a Proxy is getting the current session.
We are developing a Web-Application and after loading business objects, the session is closed.
Now when NHibernate tries to lazily load any dependent object, it of course throws an Exception, because there is no current session.
For testing I implemented a SessionContext class like this:
Code:
public class SessionContext : CurrentSessionContext
{
public SessionContext(ISessionFactoryImplementor implementor)
{
}
protected override ISession Session
{
get { return Database.Current.Session.Open(); }
set { }
}
}
But this implementation is only called, when i call SessionFactory.GetCurrentSession(); in my code. I was expecting NHibernate to use this to get its current Session. But it doesnt seem to be working like this. So, where can i hook in so NHibernate uses my implementation?
Greetings!
Zorgoban