You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using client.Query<T>() one will only receive the default 20 items from the first page. If we want to get more than that or all items of the given T, then we are bound to Skip and Take ourselves in a loop.
This approach however has one major flaw. Before the first execution of the query, you basically have no idea how many items you have in total, nor does the Query<T>() extension return the total value if Queryparameter withTotal=true.
A solution to that would be a client.QueryAll<T>() extension in addition to an appropriate enumerator for that case.
The enumerator will keep track of the current page items and retrieves new ones, if the page is exhausted.
Example:
varproductQuery=client.QueryAll<Product>().Where(x =>x.MasterData.Published);foreach(varproductinproductQuery){;// Do things with the product}
As you can see, the syntax would be nearly the same, while providing all items of a requested type on demand. So it will also not flood the machines memory with all the requested items at once.
The text was updated successfully, but these errors were encountered:
Still thinking about this. The problem here is that this would only work as long as no other sort criteria has been added to the command. So please be patient before we take a closer look to your PR.
The command itself still has all the functionality intact. The only thing it does is adding an enumerator that actually yields all results instead of just the first default page. All criteria should apply on the API. Maybe I miss something and you can elaborate?
I'm not sure how this works, but bumping this after 3 and a half years.
I no longer need this functionality, which is why I didn't bother keeping track of it.
But what I last wrote still stands, I assume. All criteria still apply. I just wrapped the code to yield all results, instead of just the default page.
Using
client.Query<T>()
one will only receive the default 20 items from the first page. If we want to get more than that or all items of the given T, then we are bound to Skip and Take ourselves in a loop.This approach however has one major flaw. Before the first execution of the query, you basically have no idea how many items you have in total, nor does the
Query<T>()
extension return the total value if QueryparameterwithTotal=true
.A solution to that would be a
client.QueryAll<T>()
extension in addition to an appropriate enumerator for that case.The enumerator will keep track of the current page items and retrieves new ones, if the page is exhausted.
Example:
As you can see, the syntax would be nearly the same, while providing all items of a requested type on demand. So it will also not flood the machines memory with all the requested items at once.
The text was updated successfully, but these errors were encountered: