4
votes

Is someone able to explain NHibernate's CallSessionContext, and contrast it to ThreadStaticSessionContext.

The best explaination I have been able to find, has been from the NHibernate documentation :

  • NHibernate.Context.CallSessionContext- current sessions are tracked by CallContext. You are responsible to bind and unbind an ISession instance with static methods of class CurrentSessionContext.

  • NHibernate.Context.ThreadStaticSessionContext - current session is stored in a thread-static variable. This context only supports one session factory. You are responsible to bind and unbind an ISession instance with static methods of class CurrentSessionContext.

I am familiar with the WebSessionContext, as my usual use of NHibernate is in web applications. This time I am building a WCF service, to be hosted in IIS, and am trying to determine which implementation of ICurrentSessionContext is preferable.

I would like to know the implications of choosing one vs the other, both in this particular case (WCF service), and in general for future reference.

1

1 Answers

2
votes

NHibernate 3 has a WCF-specific implementation, WcfOperationSessionContext