methodApplyFilter<T>
public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, FilterParameters parameters, IFilterOperatorProvider<T> customOperatorProvider, int maxComplexity = 20, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.ThrowException, IEnumerable<string>? allowedProperties = null, IPaginationOptions? options = null)
Applies dynamic string filtering to the queryable source with custom operator support.
- source: this IQueryable<T>
- The queryable source to filter.
- parameters: FilterParameters
- The filter parameters.
- customOperatorProvider: IFilterOperatorProvider<T>
- The custom operator provider defining additional filter operators.
- maxComplexity: int
- The maximum allowed clause complexity for the filter expression.
- unknownFieldBehavior: FilterUnknownFieldBehavior
- The behavior when an unrecognized field is encountered.
- allowedProperties: IEnumerable<string>?
- An optional whitelist of property names permitted for filtering.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.
methodApplyFilter<T>
public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, FilterParameters parameters, int maxComplexity = 20, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.ThrowException, IEnumerable<string>? allowedProperties = null, IPaginationOptions? options = null)
Applies dynamic string filtering to the queryable source.
- source: this IQueryable<T>
- The queryable source to filter.
- parameters: FilterParameters
- The filter parameters.
- maxComplexity: int
- The maximum allowed clause complexity for the filter expression.
- unknownFieldBehavior: FilterUnknownFieldBehavior
- The behavior when an unrecognized field is encountered.
- allowedProperties: IEnumerable<string>?
- An optional whitelist of property names permitted for filtering.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.
methodApplyFilter<T>
public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, IFilterProvider<T> filterProvider, FilterParameters parameters)
Applies a strongly typed filter provider to the queryable source.
- source: this IQueryable<T>
- The queryable source to filter.
- filterProvider: IFilterProvider<T>
- The strongly typed filter provider.
- parameters: FilterParameters
- The filter parameters.
Retorna: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.
methodApplySort<T>
public static IQueryable<T> ApplySort<T>(this IQueryable<T> source, SortParameters sortBy, SortDirection direction = SortDirection.Ascending, Expression<Func<T, object>>? defaultSort = null, IEnumerable<string>? allowedProperties = null)
Applies dynamic multi-column sorting to the queryable source.
- source: this IQueryable<T>
- The queryable source to sort.
- sortBy: SortParameters
- The sort parameters containing property names and directions.
- direction: SortDirection
- The default sorting direction if not specified in sort parameters.
- defaultSort: Expression<Func<T, object>>?
- An optional fallback sorting expression.
- allowedProperties: IEnumerable<string>?
- An optional whitelist of property names permitted for sorting.
Retorna: An `IQueryable<T>` with ordering applied.
methodKeyset<T>
public static KeysetBuilder<T> Keyset<T>(this IQueryable<T> source, CursorPaginationParameters parameters, int defaultPageSize = 10, ICursorEncoder? cursorEncoder = null, bool acceptLegacyCursors = true)
Initializes a builder for N-column keyset pagination.
- source: this IQueryable<T>
- The queryable source to paginate.
- parameters: CursorPaginationParameters
- The cursor pagination parameters.
- defaultPageSize: int
- The fallback page size when not specified in parameters.
- cursorEncoder: ICursorEncoder?
- An optional custom cursor encoder.
- acceptLegacyCursors: bool
- A value indicating whether to accept legacy v1 cursor formats.
Retorna: A new `KeysetBuilder<T>` instance.
methodToPagedAsyncEnumerable<T>
public static IAsyncEnumerable<T> ToPagedAsyncEnumerable<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null)
Returns an `IAsyncEnumerable<T>` that asynchronously streams entities for the requested page.
- source: this IQueryable<T>
- The queryable source to stream from.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- maxPageSize: int?
- The maximum allowed page size.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: An `IAsyncEnumerable<T>` yielding entities sequentially.
methodToPagedListAsync<T, TResult>
public static async Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, bool useApproximateCount = false, CancellationToken cancellationToken = default, IPaginationOptions? options = null)
Materializes the query into a projected `PagedList<TResult>` using offset pagination.
- source: this IQueryable<T>
- The queryable source to paginate.
- selector: Expression<Func<T, TResult>>
- A projection expression applied on the database server.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- countTotal: bool
- A value indicating whether to compute the total record count.
- maxPageSize: int?
- The maximum allowed page size.
- useApproximateCount: bool
- A value indicating whether to use database table statistics for approximate counting.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: A task representing the asynchronous operation. The task result contains the projected paged list.
methodToPagedListAsync<T, TResult>
public static Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, bool useApproximateCount = false, int? maxPageSize = null, IEnumerable<string>? allowedProperties = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)
Applies dynamic filtering, sorting, server-side projection, and offset pagination in a single operation.
- source: this IQueryable<T>
- The queryable source to filter, sort, project, and paginate.
- filter: FilterParameters
- The dynamic filter parameters.
- sortBy: SortParameters
- The dynamic sort parameters.
- selector: Expression<Func<T, TResult>>
- A projection expression applied on the database server.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- countTotal: bool
- A value indicating whether to compute the total record count.
- useApproximateCount: bool
- A value indicating whether to use database table statistics for approximate counting.
- maxPageSize: int?
- The maximum allowed page size.
- allowedProperties: IEnumerable<string>?
- An optional whitelist of property names permitted for filtering and sorting.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: A task representing the asynchronous operation. The task result contains the projected paged list.
methodToPagedListAsync<T>
public static Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, PaginationParameters parameters, bool countTotal = true, bool useApproximateCount = false, int? maxPageSize = null, IEnumerable<string>? allowedProperties = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)
Applies dynamic filtering, sorting, and offset pagination in a single operation.
- source: this IQueryable<T>
- The queryable source to filter, sort, and paginate.
- filter: FilterParameters
- The dynamic filter parameters.
- sortBy: SortParameters
- The dynamic sort parameters.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- countTotal: bool
- A value indicating whether to compute the total record count.
- useApproximateCount: bool
- A value indicating whether to use database table statistics for approximate counting.
- maxPageSize: int?
- The maximum allowed page size.
- allowedProperties: IEnumerable<string>?
- An optional whitelist of property names permitted for filtering and sorting.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: A task representing the asynchronous operation. The task result contains the paged list.
methodToPagedListAsync<T>
public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, bool useApproximateCount = false, IPaginationOptions? options = null, CancellationToken cancellationToken = default)
Materializes the query into a `PagedList<T>` using offset pagination.
- source: this IQueryable<T>
- The queryable source to paginate.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- countTotal: bool
- A value indicating whether to compute the total record count.
- maxPageSize: int?
- The maximum allowed page size.
- useApproximateCount: bool
- A value indicating whether to use database table statistics for approximate counting.
- options: IPaginationOptions?
- Optional pagination configuration options.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
Retorna: A task representing the asynchronous operation. The task result contains the paged list.
methodToPagedListBatchedAsync<T>
public static IAsyncEnumerable<IPagedList<T>> ToPagedListBatchedAsync<T>(this IQueryable<T> source, int batchSize = 1000, CancellationToken cancellationToken = default, IPaginationOptions? options = null)
Processes a query in offset-paginated batches, yielding each page as an `IPagedList<T>`.
- source: this IQueryable<T>
- The queryable source to paginate in batches.
- batchSize: int
- The number of items to fetch per batch.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
- options: IPaginationOptions?
- Optional pagination configuration options.
Retorna: An `IAsyncEnumerable<T>` yielding paged lists sequentially.
methodToPagedListWithoutCountAsync<T, TResult>
public static Task<IPagedList<TResult>> ToPagedListWithoutCountAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)
Materializes the query into a projected `PagedList<TResult>` using count-less offset pagination (N+1 lookahead probe).
- source: this IQueryable<T>
- The queryable source to paginate.
- selector: Expression<Func<T, TResult>>
- A projection expression applied on the database server.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- maxPageSize: int?
- The maximum allowed page size.
- options: IPaginationOptions?
- Optional pagination configuration options.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
Retorna: A task representing the asynchronous operation. The task result contains the projected paged list without computing total count.
methodToPagedListWithoutCountAsync<T>
public static Task<IPagedList<T>> ToPagedListWithoutCountAsync<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)
Materializes the query into a `PagedList<T>` using count-less offset pagination (N+1 lookahead probe).
- source: this IQueryable<T>
- The queryable source to paginate.
- parameters: PaginationParameters
- The pagination parameters defining page number and page size.
- maxPageSize: int?
- The maximum allowed page size.
- options: IPaginationOptions?
- Optional pagination configuration options.
- cancellationToken: CancellationToken
- A cancellation token to observe while waiting for the task to complete.
Retorna: A task representing the asynchronous operation. The task result contains the paged list without computing total count.