I have LINQ expression like
var a = ctx.EntitySet
.OrderByDescending(t => t.Property)
.Skip(pageIndex * size)
.Take(size);
OrderBy() should call before Skip() and Take(), but sorting happens at the end. Can I solve this problem?
Sorry, many people didn't understand my question. Query runs without any errors, but I want
//It is I want
1) Sorting ALL data
2) Use Skip() and Take()
What I have in result if I do like at my example: 1) Skip() 2) Take() 3) Sorting only taked elements!
i don't know why , but somehow it works for me , hope it helps you
var a1 = from p in ctx.EntitySet
.OrderByDescending(t => t.Property)
select p;
var a2 = from p in a1
.Skip(pageIndex * size)
.Take(size)
select p;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With