MJ Richardson
MJ Richardson

Reputation: 1441

NHibernate CallSessionContext vs ThreadStaticSessionContext

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.

Upvotes: 4

Views: 1708

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52735

NHibernate 3 has a WCF-specific implementation, WcfOperationSessionContext

Upvotes: 2

Related Questions