In some cases, we only need specific properties of an entity. In other cases, we may need the results of an aggregate function, such as average or count. In this recipe, we'll show you how to write
QueryOver queries with projections and aggregates.
Complete the Getting Ready instructions at the beginning of this chapter.
QueryOverProjectionsto the project.
QueryOverAggregateQueriesto the folder, having the following code:
using System; using System.Collections.Generic; using System.Linq; using NH4CookbookHelpers.Queries; using NH4CookbookHelpers.Queries.Model; using NHibernate; using NHibernate.Criterion; namespace QueryRecipes.QueryOverProjections ...