Search code examples
wcfodatawcf-data-services

how to increase return records size odata service from client side?


I have wcf odata service return me some records, but when it records are returned it returns some limited number of records (100). I searched the web and found that there are some configuration parameters set in service initialization.

  • MaxResultSetsPerCollection
  • SetEntitySetPageSize

Reference

But is it possible to override these from the client side, when the service is consumed. if so how to do it. I want to set records returned to be 1000 instead of 100


Solution

  • No, you cannot increase the server-defined page size from a client. The goal of server-driven paging is to allow a server to only allocate a certain amount of its resources to a single request. As a client, you can request fewer results than the server would normally send back using the $top and $skip query parameters in the request URL, but you cannot request more.

    If a server gives you 100 entities at a time, you can request the next set of 100 by following the continuation URL (aka "next link") provided at the end of the payload. If you're the using WCF Data Service client library, take a look at the answer to this question for an example of how to follow a next link: paging through NetFlix odata results.