nhibernatecastle-activerecordisessionsession-scope

Is SessionScope exact equivalent of ISession?


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?


Solution

  • 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: