I have created an OData wrapper layer to my existing data engine. All operations including: sorting filtering and paging are passed directly to my existing engine and retrieve the needed data.
problem is with the paging: second page results are retrieved from my existing engine, but later odata skips the amount of "skip=" and sends empty collection to the client. for example: I am paging "Products", there are 100 in the DB. First page gets 10 to the server, skips 0 and sends the 10 to the client. second page gets 10 to the server, skips 10 and sends nothing to the customer.
Is there a way around this?
p.s. Page size my vary according to client request. I cannot write it hardcoded on the server.
I found this method call in my code and added the first 2 lines:
public IQueryable<TElement> CreateQuery<TElement>(Expression expression)
{
if (expression.ToString().Contains(".Skip("))
expression = (expression as MethodCallExpression).Arguments[0];
return new DSPLinqQuery<TElement>(this, expression);
}
this way the larger expression being built will not contain skip(10)