SessionScope 与 ISession 完全相同吗?
Castle ActiveRecord 的 SessionScope 与 NHibernate 的 ISession 完全相同吗?如果是,为什么 Castle ActiveRecord 提供了重复功能?如果不是,它们的区别是什么?
Is Castle ActiveRecord's SessionScope exact equivalent of NHibernate's ISession? If yes, why Castle ActiveRecord has provided a duplicate feature? If no, what are their differences?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SessionScope 基本上是 NHibernate 的 ISession 的包装器。它作为环境会话工作,也就是说,存在隐式“当前”SessionScope 的概念,它是可堆叠的,并且其存储可通过 IThreadScopeInfo 的实现进行配置,如 ThreadScopeInfo、WebThreadScopeInfo 和 HybridWebThreadScopeInfo。这类似于 NHibernate 的上下文会话,但是 ActiveRecord 有将此概念扩展到范围的其他实现,例如 TransactionScope 和 ConversationalScope。
ActiveRecord 文档中的更多信息:
SessionScope is basically a wrapper around NHibernate's ISession. It works as an ambient session, that is, there is the notion of an implicit "current" SessionScope, it's stackable and its storage is configurable via implementations of IThreadScopeInfo, like ThreadScopeInfo, WebThreadScopeInfo, and HybridWebThreadScopeInfo. This is similar to NHibernate's contextual sessions, however ActiveRecord has extended this concept to other implementations of scopes, such as TransactionScope and ConversationalScope.
More information in the ActiveRecord docs: