Obtains the current session.

Namespace:  NHibernate
Assembly:  NHibernate (in NHibernate.dll)

Syntax

Visual Basic (Declaration)
Function GetCurrentSession As ISession
C#
ISession GetCurrentSession()
Visual C++
ISession^ GetCurrentSession()
JavaScript
function getCurrentSession();

Return Value

The current session.

Remarks

The definition of what exactly "current" means is controlled by the ICurrentSessionContext implementation configured for use.

Exceptions

ExceptionCondition
NHibernate..::.HibernateExceptionIndicates an issue locating a suitable current session.

See Also