Skip to content

ExecuteExtensions.ExecutePagedQueryAsync

Mike King edited this page Sep 30, 2025 · 2 revisions

ExecuteExtensions.ExecutePagedQueryAsync Method

Overloads
ExecutePagedQueryAsync<TSource>(this DatabaseFacade, string, long, long, CancellationToken, IEnumerable<object>) Executes a query and returns the specified page of results.
ExecutePagedQueryAsync<TSource>(this DatabaseFacade, FormattableString, long, long, CancellationToken) Executes a query and returns the specified page of results.

ExecuteExtensions.ExecutePagedQueryAsync<TSource>(this DatabaseFacade, string, long, long, CancellationToken, IEnumerable<object>) Method

Executes a query and returns the specified page of results.

public static System.Threading.Tasks.Task<DotDoc.EntityFrameworkCore.Extensions.Execute.PagedQueryResult<TSource>> ExecutePagedQueryAsync<TSource>(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database, string sql, long page, long pageSize, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken), System.Collections.Generic.IEnumerable<object?> parameters)
    where TSource : class;

Type parameters

TSource

The type of the elements of the source.

Parameters

database Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade

The Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade for the context.

sql System.String

The SQL query to execute.

page System.Int64

Page number to return (starting at 0).

pageSize System.Int64

Number of records per page.

cancellationToken System.Threading.CancellationToken

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

parameters System.Collections.Generic.IEnumerable<System.Object>

Parameters to use with the SQL.

Returns

System.Threading.Tasks.Task<DotDoc.EntityFrameworkCore.Extensions.Execute.PagedQueryResult<TSource>>
An instance of PagedQueryResult<TSource> containing the page data (If the page number is past the end of the table then the it will become the last page).

ExecuteExtensions.ExecutePagedQueryAsync<TSource>(this DatabaseFacade, FormattableString, long, long, CancellationToken) Method

Executes a query and returns the specified page of results.

public static System.Threading.Tasks.Task<DotDoc.EntityFrameworkCore.Extensions.Execute.PagedQueryResult<TSource>> ExecutePagedQueryAsync<TSource>(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database, System.FormattableString sql, long page, long pageSize, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken))
    where TSource : class;

Type parameters

TSource

The type of the elements of the source.

Parameters

database Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade

The Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade for the context.

sql System.FormattableString

The System.FormattableString representing a SQL query with parameters.

page System.Int64

Page number to return (starting at 0).

pageSize System.Int64

Number of records per page.

cancellationToken System.Threading.CancellationToken

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

Returns

System.Threading.Tasks.Task<DotDoc.EntityFrameworkCore.Extensions.Execute.PagedQueryResult<TSource>>
An instance of PagedQueryResult<TSource> containing the page data (If the page number is past the end of the table then the it will become the last page).

Clone this wiki locally