In normal query scenarios we can rely on NHibernate's mechanisms to convert the query results into entities and objects that we can use. Sometimes, however, the queries may not map to classes we have defined in the mappings or maybe we want to customize what is returned. NHibernate provides many extension points and one of those is a result transformer, which can be injected into the flow of a query. It transforms the results of a query into the results that we need.
In the following recipe, we will try out two of the most commonly used built-in transformers.
ResultTransformersto the project.