I am looking for a way to get a list of items in sequence, meaning that each calls will retrieve a set of database values in order.
Ok, that's not very clear, so let me show you.
Say that I have 200 entries of objects with a date properties, each entered from the beginning of February to today.
My first call would retrieve a set of the 20 latest entries, then the next call would retrieve entries 21-40, then the next call 41-60, and so on, as long as there's data to get.
I am using C# / Entity Framework and am familiar with Linq and the LinqKit, but that's a new challenge to me and am opened to any suggestions!
EDIT Ok, based on comments, my example is not adequate.
So let's say instead of having 200 I have 200 MILLIONS of entries, and more are pouring in. But, as I mentioned, I just want to load the first twenty, then the next twenty on each call, but I don't know how many times the user may make the call, so that's why I cannot "align" Take(20)
calls since this is dynamic.
EDIT2
Here's a sample of code to guide you and me on my work :)
List<Book> listBooks = (from b in DbContext.Books
orderby b.DateAdded
select b).Take(count).ToList();
See, this chunk of code is not perfect because it will always return the 20 latests books added. But at the second call I would like to have the 20 next, then on the third call the 41-60 books, and so on.
EDIT3
After some research I have found something that might suit my needs:
However I will need to work around a bit to figure out how to make this work.