I've had no luck getting paging to work. What I'm seeing is that the Odata layer is skipping the data that the controller is returning (i.e. I want to control paging and filtering server-side). If I make a request without $skip= then the API returns 10 records. If I set $skip=100, 0 records are returned. Any suggestions? Controller method below:
[EnableQuery(PageSize=10)]
public IHttpActionResult GetProducts(ODataQueryOptions<Product>
queryOptions)
{
List<Product> results = new List<Product>();
for (int i = 0; i < 10; i++)
{
results.Add(new Product() { Id = Guid.NewGuid(), Name=
"Product"+ i.ToString() });
}
Request.ODataProperties().NextLink =
newUri(getNextUrl(queryOptions.Skip,10));
return Ok<IQueryable<Product>>(results.AsQueryable());
}