Reputation: 23
As you see,what would happen if I use WcfOperationSessionContext in the non-WCF scenario?
Any answer will be helpful! Thanks!
Upvotes: 0
Views: 1349
Reputation: 123881
In this case the self descriptive name WcfOperationSessionContext
could not tell you more.
This session context implementation is only for WCF scenario.
If you need more take a look on the implementation here:
The class summary:
/// <summary>
/// Provides a <see cref="ISessionFactory.GetCurrentSession()">current session</see>
/// for the current OperationContext in WCF.
/// Works only during the lifetime of a WCF operation.
/// </summary>
public class WcfOperationSessionContext : MapBasedSessionContext
...
Take a look on the others to get more understanding what would suite to you in your multi-thread environment:
One of thread session context will be better choice
But as you can read in documentation 2.3. Contextual Sessions, it is always up to you to bind and unbind ISession
instance:
NHibernate.Context.ThreadStaticSessionContext (...) You are responsible to bind and unbind an ISession instance with static methods of class CurrentSessionContext.
NHibernate.Context.WcfOperationSessionContext (...) You are responsible to bind and unbind an ISession instance with static methods of class CurrentSessionContext.
Upvotes: 1