I've got an ASP.NET WebAPI OData service. One of the EntitySetController<,>.Get() methods returns an entity framework query. Since the entity framework query returns a lot of rows, I want to use server-side paging to keep the memory footprint reasonable. Also, $skiptoken is much faster than $skip in this case.
The [Queryable(PageSize = n)] attribute does not seem to accomplish exactly what I need for two reasons:
Is there any way to accomplish what I'm trying to do?
There's already a work item for this:
http://aspnetwebstack.codeplex.com/workitem/500
you can vote for. In the mean time, there's nothing stopping you from not using PageSize, and implementing paging yourself. ODataQueryOptions
does expose the $skiptoken raw value for you to parse, and you can return a PageResult<T>
to represent a page of your results with a next page link based on $skiptoken.