Share via


Container.ReadManyItemsAsync<T> Methode

Definition

Liest mehrere Elemente aus einem Container mithilfe von Id- und PartitionKey-Werten.

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.FeedResponse<T>> ReadManyItemsAsync<T> (System.Collections.Generic.IReadOnlyList<(string id, Microsoft.Azure.Cosmos.PartitionKey partitionKey)> items, Microsoft.Azure.Cosmos.ReadManyRequestOptions readManyRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReadManyItemsAsync : System.Collections.Generic.IReadOnlyList<ValueTuple<string, Microsoft.Azure.Cosmos.PartitionKey>> * Microsoft.Azure.Cosmos.ReadManyRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.FeedResponse<'T>>
Public MustOverride Function ReadManyItemsAsync(Of T) (items As IReadOnlyList(Of ValueTuple(Of String, PartitionKey)), Optional readManyRequestOptions As ReadManyRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of FeedResponse(Of T))

Typparameter

T

Parameter

items
IReadOnlyList<ValueTuple<String,PartitionKey>>

Liste des Elements. ID und PartitionKey

readManyRequestOptions
ReadManyRequestOptions

Anforderungsoptionen für ReadMany-Vorgang

cancellationToken
CancellationToken

(Optional) CancellationToken stellt den Anforderungsabbruch dar.

Gibt zurück

Ein Task , der ein FeedResponse<T> enthält, das die typisierten Elemente umschließt.

Beispiele

public class ToDoActivity{
    public string id {get; set;}
    public string status {get; set;}
}

IReadOnlyList<(string, PartitionKey)> itemList = new List<(string, PartitionKey)>
{
    ("Id1", new PartitionKey("pkValue1")),
    ("Id2", new PartitionKey("pkValue2")),
    ("Id3", new PartitionKey("pkValue3"))
};

FeedResponse<ToDoActivity> feedResponse = this.Container.ReadManyItemsAsync<ToDoActivity>(itemList);

Hinweise

ReadManyItemsAsync<T>(IReadOnlyList<ValueTuple<String,PartitionKey>>, ReadManyRequestOptions, CancellationToken) soll eine bessere Latenz als eine Abfrage mit IN-Anweisungen ausführen, um eine große Anzahl unabhängiger Elemente abzurufen.

Gilt für: