Home

Continuation Support

edited April 2012
We are executing a query against an OData source that has pagination enabled for 200 rows. This means it uses the OData skiptoken mechanism to page through the resultset.

LinqPad seems to only support returning the first page of results. Is there anyway to make LinqPad return the full resultset up to the configured row limit?

Thanks

Joe

Comments

  • The latest beta supports this, although there are some restrictions:
    - It works only in results-to-text mode (not data grids)
    - You must select the the entire row (not into an anonymous type)
  • I just tried this with beta 4.44.04 and it isn't working as I would expect. Maybe I am missing something on what the restrictions are?

    I am using a connection to a SharePoint 2010 ListData.svc OData service. The first returns 1325, the second returns only the first 1000 (pagination stops it) as does the third.

    Documents.Where (d => d.GroupId < 1000).Count()

    Documents.Where (d => d.GroupId < 1000).ToList().Count()

    Util.WriteCsv(Documents.Where (d => d.GroupId < 1000), @"c:\docs.csv");

    I understand the first one really invokes the $count parameter on the URL - I just included it to demonstrate the discrepancy. I can see from the request that the last item in the returned XML is the tag indicating there is additional data:

    <link rel="next" href="http://server/_vti_bin/ListData.svc/Documents?$filter=GroupId%20lt%201000&$skiptoken=1007" />

    LINQPad is configured to evaluate the script in "C# Expression" mode.
  • It's not designed to return all rows - the pagination support in LINQPad gives you a "Next" hyperlink at the end of the results when you Dump then so you can go to the next page. I guess the workaround would be to write an extension method that takes an OData results query and returns an enumerable that gives all results - automatically paginating as necessary.
  • Thanks for your explanation. I am not seeing a "Next" hyperlink - possibly because my OData source is configured to return 1000 rows and LINQPad halts furthering dumping at 1000 rows?
  • Quite possibly. You can increase the limit up to 10,000 in Edit | Preferences.
  • Thanks @JoeAlbahari - this worked. Not sure why I didn't think of trying it in the first place as I have adjusted that preference before...

    Anyway - this was doubly cool as it opened a new query window with the Execute<>(uri) method already populated with the same URI and included the skip token. This opens up some other avenues for testing as I often have LINQPad generate a URI that I then use in JavaScript when talking to the OData service.

    Double prizes. Today is a great day!
  • On my oData service the page size is 25 so when I build my Linq Query in Linqpad I only get the first 25 items. Expected a next page option at the bottom to allow me to page through the data but as mentioned above

    "You must select the the entire row (not into an anonymous type) "

    When do you plan to support Anonymous type for oData queries?
Sign In or Register to comment.