1

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?

Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288

2 Answers2

1

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

Community
  • 1
  • 1
Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
0

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

Diego Mijelshon
  • 52,548
  • 16
  • 116
  • 154