Querying the workflow
NHibernate supports different ways of retrieving data from database. The basic semantics of writing a NHibernate query is no different than that of a standard SQL query which consists of the following three main parts:
You specify which tables are involved in query
You specify an optional filter using
WHERE
statementYou specify which columns you want to return using
SELECT
statement
There are other optional things you can add to a SQL query such as ordering, grouping, pagination, and so on, which is also supported by NHibernate. Queries written in NHibernate fundamentally differ from standard SQL queries on one aspect – composability. A query is represented by a query object. You can compose a query object by incrementally adding constructs such as joins with more tables, ordering, the where
clauses, and so on. When you have finished building the query object, you call one of the terminal method on it, such as List<T>
or First<T>
which will tell NHibernate...