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
{{ message }}
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
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.
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.