NHibernate.FlowQuery (FlowQuery) is an open source wrapper for the NHibernate ICriteria API providing a lambda-based, refactoring-friendly and “magic string”-free interface for querying against NHibernate.

FlowQuery contains features such as:

  • Simple querying over the ICriteria API using lambda expressions
  • Functionality to reveal hidden members using configurable conventions
  • Ability to project your queries into anonymous types and also into nested types
  • Simple, easy-to-use auto-mapping functionality to map entities directly to a model object (DTO, ViewModel, etc.)

An example:

UserRoleLink link = null;

var users = session.FlowQuery<User>()
    .Inner.Join(u => u.Roles, () => link)
    .Where(u => link.Role == Role.Administrator)
    .Select(u => new

Current build (version 2.3.0) is compiled against .NET 4.0 and NHibernate 4.0 and can be downloaded at: http://sourceforge.net/projects/nhflowquery/

You can also install FlowQuery using NuGet:

PM> Install-Package NHibernate.FlowQuery


FlowQuery is doing pretty much what QueryOver does (which is bundled with NHibernate). However, FlowQuery has its own syntax which might be more appealing to you or just easier to follow/understand. The reason for choosing FlowQuery over QueryOver, or whether to do so at all, is yours to decide.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: