Compartilhar via


Conflicts.ReadCurrentAsync<T> Método

Definição

Lê o item que originou o conflito.

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))

Parâmetros de tipo

T

Parâmetros

conflict
ConflictProperties

O conflito para o qual queremos ler o item.

partitionKey
PartitionKey

A chave de partição do item.

cancellationToken
CancellationToken

(Opcional) CancellationToken que representa o cancelamento da solicitação.

Retornos

O estado atual do item associado ao conflito.

Exemplos

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);
        }
    }
}

Aplica-se a

Confira também