NHibernate.FlowQuery v1.2 Released

There hasn’t been too many updates here the last two years so I thought it would be about time I said “Hi, I’m alive!”.
I’ve just uploaded a new version of NHibernate.FlowQuery ( FlowQuery ). Version 1.2 of FlowQuery can be downloaded here. The new version is built against NHibernate 3.3.2.

This release adds overloads for the *Join-methods on ISubFlowQuery giving you the possibility to specify extra onClause-criteria there as well as you have been able to do on the regular IFlowQuery for quite some time now. I have also added a short hand to IFlowQuery called Any() with a few overloads for specifying conditions. The methods works pretty much the same as the Any() method in the Linq API.

Example of Any() using:

bool anyUserOnline = Query<User>()
    .Any(u => u.IsOnline);

How to solve the above with previous version:

bool anyUserOnline = Query<User>()
    .Where(u => u.IsOnline)
    .Take(1)
    .Count() > 0;

As you can see, this gives you a little less to write in these occasions. I hope it’ll come in handy.

Enjoy! (:

/Niklas Källander

Advertisements

NHibernate.FlowQuery v0.9 Released

Just uploaded a new version of NHibernate.FlowQuery ( FlowQuery ). Version 0.9 of FlowQuery can be downloaded here. The new version is built against both NHibernate 2.1.2 and NHibernate 3.1.0. Both builds contains several minor bug fixes and small improvements to the joining API. The build against NHibernate 3.1.0 however also contains overloads for all Join methods that takes a parameter specifying extra on-clause criteria.

Example:

UserGroupLink link = null;

var activeGroupIds = Query<User>()
    .Join(u => u.Groups, () => link, u => link.IsActive)
    .Select(u => link.Group.Id);

The above Join-call will translate into something like this ( in the ICriteria API ):

criteria.CreateAlias("Groups", "link", JoinType.InnerJoin, Restrictions.Eq("link.IsActive", true));

That’s about it for now.

Enjoy! (:

/Niklas Källander

NHibernate.FlowQuery v0.7 Released

Today I released a minor update of NHibernate.FlowQuery (FlowQuery). Version 0.7 of FlowQuery can be downloaded here. The new version merely adds a small amount of functionality for joining hidden members and using select setup when projecting queries. It also fixes a bug when selecting hidden fields (which was somehow overlooked in the previous version).

The added functionality for joining hidden members is only a few overloads on the Join-methods to pipeline lambda expressions on to the Reveal-helper. This to reduce verbosity when joining.

An example, with the previous version:

Post post = null;
Comment comment = null;

session.FlowQuery<User>()
    .Join(u => u.Posts, () => post)
    .Join(Reveal.ByConvention(() => post.Comments), () => comment)
    .Select();

With the new version:

Post post = null;
Comment comment = null;

session.FlowQuery<User>()
    .Join(u => u.Posts, () => post)
    .Join(() => post.Comments, () => comment)
    .Select();

For the sake of convenience there is also overloads to provide your own IRevealConvention:

session.FlowQuery<User>()
    .Join(u => u.Posts, () => post)
    .Join(() => post.Comments, () => comment, new UnderscoreConvention())
    .Select();

In the previous version of FlowQuery you could not use strings in the Use-part of a select setup. In the new version this is fixed and you don’t have to create your own PropertyProjection to overcome this misfortune. In other words…

session.FlowQuery<User>()
    .SelectDistinct()
        .For(x => x.Firstname).Use("Firstname")
        .Select();

…is now possible!

Enjoy! (:

/Niklas Källander