Convenience method to return a single instance that matches the query, or null if the query returns no results.

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

Syntax

Visual Basic (Declaration)
Function UniqueResult As Object
C#
Object UniqueResult()
Visual C++
Object^ UniqueResult()
JavaScript
function uniqueResult();

Return Value

the single result or nullNothingnullptra null reference (Nothing in Visual Basic)

Exceptions

ExceptionCondition
NHibernate..::.HibernateException If there is more than one matching result

See Also