XrmContext
XrmContext copied to clipboard
Paging of query results when using LINQ
We have a few cases where we are writing QueryExpression due to being able to use the continuation token / page cookie to retrieve the data in batches over more requests.
I am wondering if would make sense to make this around linq also. However i dont expect it to be easy.
I am thinking that we would be able to write set.where(...).select(...).ToPaginatedResult()
or something that make sense, that returns a
class PagedResult<T> : IList<T>{
public string ContinuationToken {get;set;}
}
Where is the ContinuationToken is the cookie or some base64 encoded string of the data needed to return the next page?
Then on the second result, the same query can be used.
set.where(...).select(...).ToPaginatedResult(continuationToken)
Which allows me to persist the continuation token between calls and continue until no continuation token is present.
@magesoe @bo-stig-christensen Does this make sense to you to do?