[英]Limiting query results using TableClient.Query from Azure.Data.Tables
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.在较旧的 API (WindowsAzure.Storage) 中,有用于此目的的 Take() 方法,但似乎已在此较新的 API 中删除。 I haven't been able to find a way to perform the same function, can someone provide an answer to this?
我一直无法找到执行相同功能的方法,有人可以提供答案吗?
Please add linq
to the usings:请将
linq
添加到使用中:
using System.Linq;
MS Docs: Enumerable.Take Method MS Docs:Enumerable.Take 方法
Namespace: System.Linq
命名空间:System.Linq
You can use $filter
, $top
or $select
to limit query results.您可以使用
$filter
、 $top
或$select
来限制查询结果。
$filter
Returns only tables or entities that satisfy the specified filter. $filter
仅返回满足指定过滤器的表或实体。 Note that no more than 15 discrete comparisons are permitted within a $filter string.请注意,在 $filter 字符串中最多允许进行 15 个离散比较。
$top
Returns only the top n tables or entities from the set. $top
只返回集合中前 n 个表或实体。
$select
Returns the desired properties of an entity from the set. $select
从集合中返回一个实体的所需属性。
To return the top n entities for any query, specify the $top query option.要返回任何查询的前 n 个实体,请指定 $top 查询选项。 The following example returns the top 10 entities from a table named Customers:
以下示例从名为 Customers 的表中返回前 10 个实体:
Sample query –示例查询 –
https://myaccount.table.core.windows.net/Customers()?$top=10
Refer - https://docs.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#sample-query-expressions参考 - https://docs.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#sample-query-expressions
The parameter you are looking for is maxPerPage
in TableClient.Query
.您要查找的参数是
maxPerPage
中的TableClient.Query
。
From the documentation:从文档中:
maxPerPage Nullable The maximum number of entities that will be returned per page.
maxPerPage Nullable每页将返回的最大实体数。 Note: This value does not limit the total number of results if the result is fully enumerated.
注意:如果结果是完全枚举的,这个值不会限制结果的总数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.