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

Conflicts.ReadCurrentAsync<T> 方法

定义

读取导致冲突的项。

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ItemResponse<T>> ReadCurrentAsync<T> (Microsoft.Azure.Cosmos.ConflictProperties conflict, Microsoft.Azure.Cosmos.PartitionKey partitionKey, System.Threading.CancellationToken cancellationToken = default);
abstract member ReadCurrentAsync : Microsoft.Azure.Cosmos.ConflictProperties * Microsoft.Azure.Cosmos.PartitionKey * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ItemResponse<'T>>
Public MustOverride Function ReadCurrentAsync(Of T) (conflict As ConflictProperties, partitionKey As PartitionKey, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ItemResponse(Of T))

类型参数

T

参数

conflict
ConflictProperties

要读取项的冲突。

partitionKey
PartitionKey

项的分区键。

cancellationToken
CancellationToken

(表示请求取消的可选) CancellationToken

返回

与冲突关联的项的当前状态。

示例

using (FeedIterator<ConflictProperties> conflictIterator = conflicts.GetConflictQueryIterator())
{
    while (conflictIterator.HasMoreResults)
    {
        foreach(ConflictProperties item in await conflictIterator.ReadNextAsync())
        {
            MyClass intendedChanges = conflicts.ReadConflictContent<MyClass>(item);
            ItemResponse<MyClass> currentState = await conflicts.ReadCurrentAsync<MyClass>(item, intendedChanges.MyPartitionKey);
        }
    }
}

适用于

另请参阅