Which one is better for getting the last row of my table with linq to nhibernate? Why?
internal Bill GetLastBill()
{
var q = from b in session.Linq<Bill>()
select b;
return q.OrderByDescending(x => x.Id).First();
}
OR
internal Bill GetLastBill()
{
long maxId = session.Linq<Bill>().Max(i => i.Id);
var q = from b in session.Linq<Bill>()
where b.Id == maxId
select b;
return q.First();
}