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

DocumentClient.ReadConflictFeedAsync 方法

定义

重载

ReadConflictFeedAsync(String, FeedOptions)

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

ReadConflictFeedAsync(Uri, FeedOptions)

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

ReadConflictFeedAsync(String, FeedOptions)

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

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

参数

conflictsLink
String

要读取的资源的 SelfLink。 例如 /dbs/db_rid/colls/coll_rid/conflicts/

options
FeedOptions

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

返回

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

实现

例外

如果未 conflictsLink 设置 。

此异常可以封装许多不同类型的错误。 若要确定特定错误,请始终查看 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<Conflict> response = await client.ReadConflictAsync("/dbs/db_rid/colls/coll_rid/conflicts/",
                                                    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));

另请参阅

适用于

ReadConflictFeedAsync(Uri, FeedOptions)

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

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

参数

conflictsUri
Uri

冲突的 URI。

options
FeedOptions

请求的请求选项。

返回

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

实现

适用于