Does it make sense to store a NHibernate session within ThreadLocal, is it safe to assume that will be Thread Safe and would solve the lazy loading issues with sessions? Also is it safe to assume that Session will be available for as long as the thread is executing? In terms of thread I m talking about HttpRequet.
Moreover, Would I run out of sessions for NHibernate? Is there a max number of sessions? Would that be OK if I have many threads?
NHibernate session is not thread safe.
As long as you have associate a single session with one session that should work ok.
If you are going for http requests the best way to use session per request implementation, where a session is open whenever a request is started and closed when request is ended. In this case it’s safe to assume that session will be available for as long as the thread is executing.
Usually NHibernate would not run out sessions, however the better practice is to use a session with lowest possible lifespan.