Reputation: 2882
I'm trying order a Linq to NHibernate query.
var clients = (from c in session.QueryOver<Clients>()
orderby c.Nom
select c
).List();
It doesn't work : List() isn't an existing method. It works if I write that :
var clients2 = (from c in session.QueryOver<Clients>()
orderby c.Nom
select c
);
var clients3 = clients2.Asc.List();
There is a difference if orderby is used or not. In the previous code, the clients2 type is NHibernate.Criterion.Lambda.IQueryOverOrderBuilder.
var clients4 = (from c in session.QueryOver<Clients>()
select c
);
In this case clients4's type is NHibernate.Criterion.QueryOver. Does someone know this issue ?
Upvotes: 0
Views: 1412
Reputation: 373
QueryOver is not the LINQ API. You should use the Query extension method instead.
var clients = (from c in session.Query<Clients>()
orderby c.Nom
select c
).List();
Update
using NHibernate.Linq;
Upvotes: 1