At some point in the development of your application, you may find that none of the NHibernate specific querying techniques really does the trick. Maybe you need to write a query with a very specific SQL, so that it performs optimally, or maybe there's a function or stored procedure that you need to use. Thankfully, NHibernate allows you to use plain SQL queries in the native dialect of your target database and dropping out to SQL doesn't mean dropping out of NHibernate.
Add a new class named
SqlQueries
to the folder:using System.Collections.Generic; using NH4CookbookHelpers.Queries; using NH4CookbookHelpers.Queries.Model; using NHibernate; namespace QueryRecipes.QueryBySql { public class SqlQueries : IQueries { private readonly ISession _session; public SqlQueries(ISession session) { _session = session; ...