Suppose following codes:
IEnumerable<MyClass> MakeQuery()
{
var query = from m in session.Linq<MyClass>()
select m;
return query;
}
List<MyClass> m1()
{
return MakeQuery()
.Skip(10)
.Take(20)
.ToList<MyClass>();
}
List<MyClass> m2()
{
var query = from m in session.Linq<MyClass>()
select m;
return query
.Skip(10)
.Take(20)
.ToList<MyClass>();
}
Supposing all queries are same, it seems that in m1()
, Skip
and Take
does not work. Indeed its like they do not exist all.
Why this happens and how can be fixed?
I'm using linq-to-nhibernate and this methods are used for paging. Thanks.