CosmosQueryableExtensions.ToPageAsync<TSource> Method

Definition

Allows paginating through query results by repeatedly executing the same query, passing continuation tokens to retrieve successive pages of the result set, and specifying the maximum number of results per page.

[System.Diagnostics.CodeAnalysis.Experimental("EF9102")]
public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.CosmosPage<TSource>> ToPageAsync<TSource> (this System.Linq.IQueryable<TSource> source, int pageSize, string? continuationToken, int? responseContinuationTokenLimitInKb = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9102")>]
static member ToPageAsync : System.Linq.IQueryable<'Source> * int * string * Nullable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.CosmosPage<'Source>>
<Extension()>
Public Function ToPageAsync(Of TSource) (source As IQueryable(Of TSource), pageSize As Integer, continuationToken As String, Optional responseContinuationTokenLimitInKb As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of CosmosPage(Of TSource))

Type Parameters

TSource

Parameters

source
IQueryable<TSource>

The source query.

pageSize
Int32

The maximum number of results in the returned CosmosPage<T>. The page may contain fewer results if the database did not contain enough matching results.

continuationToken
String

An optional continuation token returned from a previous execution of this query via ContinuationToken. If null, retrieves query results from the start.

responseContinuationTokenLimitInKb
Nullable<Int32>

Limits the length of continuation token in the query response.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<CosmosPage<TSource>>

A CosmosPage<T> containing at most pageSize results.

Attributes

Applies to