views:

79

answers:

1

Im currently building a remote object service that will expose a Server Activated object (per call, not singleton) that uses NHibernate. What i would like to know is there a way to tie a Nhibernate Isession to a .net Remote equivalent to the HttpSession.Context- an ISession per call of my remote object.

I have a feeling that a per thread ISession should work (every call for my remote object will be serviced by a different thread, correct?) but if anyone can shed any light on this, i would greatly appreciate it.

A: 

Remoting has a concept of thread local storage via the CallContext. You can access it via CallContext.SetData() and CallContext.GetData(). You will need to manage your ISession carefully so that you don't leave it open...

Adam Fyles