Hello
I have a problem, I'm trying to use a helper-class for a MVC project. And I get error that I must use OrderBy somehow.
this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize))
What to do? /M
Hello
I have a problem, I'm trying to use a helper-class for a MVC project. And I get error that I must use OrderBy somehow.
this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize))
What to do? /M
EF is precious about this (although LINQ-to-SQL would let you do it); just add an explicit OrderBy
:
source.OrderBy(x=>x.SomeId).Skip(PageIndex * PageSize).Take(PageSize)
(or order by name, or whatever else makes sense)