Getting started with NHibernate and NHibernate Linq, I compared the various ways to write a database query in that framework.
I came up with the following alternatives:
using NHibernate criteria:
var foos = session.CreateCriteria<Foo>() .AddOrder(NHibernate.Criterion.Order.Asc("Id")) .List<Foo>();
using NHibernate Linq:
var foos = session.Linq<Foo>().OrderBy(f => f.Id);
using NHibernate Linq with Linq syntax:
var foos = from foo in session.Linq<Foo>() orderby foo.Id select foo;
All 3 statements actually generate the same SELECT statement. I guess I prefer the 2nd version.