wcf – NHibernate CallSessionContext vs ThreadStaticSessionContext

有人能够解释NHibernate的CallSessionContext,并将其与ThreadStaticSessionContext进行对比.

我能找到的最好的解释来自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.

我熟悉WebSessionContext,因为我通常使用的NHibernate是在Web应用程序中.这次我正在构建一个WCF服务,要在IIS中托管,并且我正在尝试确定哪个ICurrentSessionContext实现更可取.

我想知道在这种特殊情况下(WCF服务)选择一个与另一个的含义,并且通常用于将来的参考.

最佳答案 NHibernate 3有一个特定于WCF的实现WcfOperationSessionContext

点赞