In the older API (WindowsAzure.Storage), there was the Take() method for this purpose, but it seems that has been removed in this newer API. I haven't been able to find a way to perform the same function, can someone provide an answer to this?
CodePudding user response:
You can use $filter
, $top
or $select
to limit query results.
$filter
Returns only tables or entities that satisfy the specified filter.
Note that no more than 15 discrete comparisons are permitted within a $filter string.
$top
Returns only the top n tables or entities from the set.
$select
Returns the desired properties of an entity from the set.
To return the top n entities for any query, specify the $top query option. The following example returns the top 10 entities from a table named Customers:
Sample query –
https://myaccount.table.core.windows.net/Customers()?$top=10
CodePudding user response:
The parameter you are looking for is maxPerPage
in TableClient.Query
.
From the documentation:
maxPerPage Nullable The maximum number of entities that will be returned per page. Note: This value does not limit the total number of results if the result is fully enumerated.
CodePudding user response:
Please add linq
to the usings:
using System.Linq;
MS Docs: Enumerable.Take Method
Namespace: System.Linq