你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

DocumentClient.ReadTriggerFeedAsync 方法

定义

重载

ReadTriggerFeedAsync(String, FeedOptions)

以异步操作的形式从 Azure Cosmos DB 服务读取集合的 Trigger 源 (序列) 。

ReadTriggerFeedAsync(Uri, FeedOptions)

从 Azure Cosmos DB 服务以异步操作的形式读取集合的触发器的源 (序列) 。

ReadTriggerFeedAsync(String, FeedOptions)

以异步操作的形式从 Azure Cosmos DB 服务读取集合的 Trigger 源 (序列) 。

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>> ReadTriggerFeedAsync (string triggersLink, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadTriggerFeedAsync : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>>
override this.ReadTriggerFeedAsync : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>>
Public Function ReadTriggerFeedAsync (triggersLink As String, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of Trigger))

参数

triggersLink
String

要读取的资源的 SelfLink。 例如 /dbs/db_rid/colls/col_rid/triggers/

options
FeedOptions

(可选) 请求的请求选项。

返回

一个 System.Threading.TasksResourceResponse<TResource> ,它包含包装 Trigger 包含读取资源记录的 。

实现

例外

如果未 triggersLink 设置 。

此异常可以封装许多不同类型的错误。 若要确定特定错误,请始终查看 StatusCode 属性。 创建文档时可能会获取的一些常见代码包括:

StatusCode异常原因
404NotFound - 这意味着你尝试读取的资源源不存在。 检查父删除是否正确。
429TooManyRequests - 这意味着已超出每秒请求单位数。 请参阅 DocumentClientException.RetryAfter 值,了解在重试此操作之前应等待多长时间。

示例

int count = 0;
string continuation = string.Empty;
do
{
    // Read the feed 10 items at a time until there are no more items to read
    FeedResponse<Trigger> response = await client.ReadTriggerFeedAsync("/dbs/db_rid/colls/col_rid/triggers/",
                                                    new FeedOptions
                                                    {
                                                        MaxItemCount = 10,
                                                        RequestContinuation = continuation
                                                    });

    // Append the item count
    count += response.Count;

    // Get the continuation so that we know when to stop.
     continuation = response.ResponseContinuation;
} while (!string.IsNullOrEmpty(continuation));

另请参阅

适用于

ReadTriggerFeedAsync(Uri, FeedOptions)

从 Azure Cosmos DB 服务以异步操作的形式读取集合的触发器的源 (序列) 。

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>> ReadTriggerFeedAsync (Uri triggersUri, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadTriggerFeedAsync : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>>
override this.ReadTriggerFeedAsync : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Trigger>>
Public Function ReadTriggerFeedAsync (triggersUri As Uri, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of Trigger))

参数

triggersUri
Uri

触发器的 URI。

options
FeedOptions

请求的请求选项。

返回

表示异步操作的服务响应的任务对象。

实现

适用于