Class InfiniteQueryOptions<TArgs, TData, TPageParam>
- Namespace
- DotNetQuery.Core
- Assembly
- DotNetQuery.Core.dll
Configuration for an infinite (paginated) query created via CreateInfiniteQuery<TArgs, TData, TPageParam>(InfiniteQueryOptions<TArgs, TData, TPageParam>).
public sealed record InfiniteQueryOptions<TArgs, TData, TPageParam> : IEquatable<InfiniteQueryOptions<TArgs, TData, TPageParam>> where TData : class
Type Parameters
TArgsThe type of the arguments that identify which resource to fetch.
TDataThe type of a single page of data. Constrained to reference types because the library uses
nullto represent "no data yet" — a non-nullable value type has no way to express that.TPageParamThe type of the page parameter (cursor/offset).
- Inheritance
-
InfiniteQueryOptions<TArgs, TData, TPageParam>
- Implements
-
IEquatable<InfiniteQueryOptions<TArgs, TData, TPageParam>>
- Inherited Members
Properties
CacheTime
Overrides the global CacheTime for this query.
public TimeSpan? CacheTime { get; init; }
Property Value
DataComparer
Equality comparer applied per page to detect structurally identical pages. During a full refetch, a re-fetched page that equals its predecessor keeps the previous instance (reference equality is preserved), and Success suppresses re-emissions when every page is equal to the previous emission. Defaults to Default.
public IEqualityComparer<TData>? DataComparer { get; init; }
Property Value
- IEqualityComparer<TData>
Fetcher
Fetches a single page of data for the given args and page parameter.
public required Func<TArgs, TPageParam, CancellationToken, Task<TData>> Fetcher { get; init; }
Property Value
- Func<TArgs, TPageParam, CancellationToken, Task<TData>>
GetNextPageParam
Derives the page parameter for the next page from the boundary info of the last loaded page. Return None to signal there are no more pages.
public required Func<InfinitePageInfo<TData, TPageParam>, PageParam<TPageParam>> GetNextPageParam { get; init; }
Property Value
- Func<InfinitePageInfo<TData, TPageParam>, PageParam<TPageParam>>
GetPreviousPageParam
Optionally derives the page parameter for the previous page from the boundary info of the
first loaded page. When null,
FetchPreviousPage() is always a no-op.
Return None to signal there are no earlier pages.
public Func<InfinitePageInfo<TData, TPageParam>, PageParam<TPageParam>>? GetPreviousPageParam { get; init; }
Property Value
- Func<InfinitePageInfo<TData, TPageParam>, PageParam<TPageParam>>
InitialData
Pre-seeds the first page so the query starts in a Success state without an initial
network fetch. The seeded page is immediately displayed while a background fetch refreshes
it. Only the first page is seeded; subsequent pages require
FetchNextPage().
public TData? InitialData { get; init; }
Property Value
- TData
InitialPageParam
The page parameter used for the very first page fetch.
public required TPageParam InitialPageParam { get; init; }
Property Value
- TPageParam
IsEnabled
When false, the query will not fetch until explicitly enabled.
Defaults to true.
public bool IsEnabled { get; init; }
Property Value
KeyFactory
Derives the cache key from the current args.
public required Func<TArgs, QueryKey> KeyFactory { get; init; }
Property Value
MaxPages
Maximum number of pages to keep. When exceeded during FetchNextPage, the oldest pages
are dropped from the front; during FetchPreviousPage, the newest are dropped from the back.
null means unbounded (default).
public int? MaxPages { get; init; }
Property Value
- int?
Name
A short, low-cardinality name used to tag metrics for this query (e.g. "users", "todos").
Metrics are never tagged with the full QueryKey — which typically includes per-entity
arguments such as an id — because that would produce one time series per distinct argument value.
When null, the first part of the derived QueryKey is used instead.
Traces and log messages always carry the full key regardless of this setting.
See IncludeQueryKeyInMetrics to opt back into per-key metrics.
public string? Name { get; init; }
Property Value
RefetchInterval
Overrides the global RefetchInterval for this query.
public TimeSpan? RefetchInterval { get; init; }
Property Value
RetryHandler
Overrides the global RetryHandler for this query.
public IRetryHandler? RetryHandler { get; init; }
Property Value
StaleTime
Overrides the global StaleTime for this query.
public TimeSpan? StaleTime { get; init; }