Defines the contract for implementations which know how to scope the notion of a current session.

Namespace: NHibernate.Context
Assembly: NHibernate (in NHibernate.dll) Version: 3.2.0.4000 (3.2.0.4000)

Syntax

C#
public interface ICurrentSessionContext
Visual Basic
Public Interface ICurrentSessionContext
Visual C++
public interface class ICurrentSessionContext

Remarks

Implementations should adhere to the following:

  • contain a constructor accepting a single argument of type ISessionFactoryImplementor
  • should be thread safe
  • should be fully serializable

Implementors should be aware that they are also fully responsible for cleanup of any generated current-sessions.

Note that there will be exactly one instance of the configured ICurrentSessionContext implementation per ISessionFactory.

It is recommended to inherit from the class CurrentSessionContext whenever possible as it simplifies the implementation and provides single entry point with session binding support.

See Also