views:

35

answers:

2

NHibernate.Context.WebSessionContext, otherwise known as web session context, plays nicely with ASP.NET, but only up to a point. As soon as I spin up a new thread, it is no longer able to retrieve current session from a HttpContext since there's actually no HttpContext for the said thread.

How do you make all this play nicely together?

A: 

NHibernate sessions are not thread-safe, so it might be a better idea to start a new session in your thread.

Diego Mijelshon
Yeah, I know that. And this is exactly why I'm asking.
Anton Gogolev
+1  A: 

Implement a hybrid session context. See my answer to this question.

Mauricio Scheffer