Class QueryOptions<TArgs, TData>
- Namespace
- DotNetQuery.Core
- Assembly
- DotNetQuery.Core.dll
Configuration options for a single query created via CreateQuery<TArgs, TData>(QueryOptions<TArgs, TData>). Per-query settings override the global defaults set on QueryClientOptions.
public sealed record QueryOptions<TArgs, TData> : IEquatable<QueryOptions<TArgs, TData>>
Type Parameters
TArgsThe type of the arguments passed to the fetcher.
TDataThe type of the data returned by the fetcher.
- Inheritance
-
QueryOptions<TArgs, TData>
- Implements
-
IEquatable<QueryOptions<TArgs, TData>>
- Inherited Members
Properties
CacheTime
Overrides the global CacheTime. null uses the global default.
public TimeSpan? CacheTime { get; init; }
Property Value
Fetcher
The async function that fetches data for the given args. Receives a CancellationToken that is cancelled when the query is disposed or superseded.
public required Func<TArgs, CancellationToken, Task<TData>> Fetcher { get; init; }
Property Value
- Func<TArgs, CancellationToken, Task<TData>>
IsEnabled
Whether the query is initially enabled. Defaults to true.
Set to false to create a disabled-by-default query without needing to call SetEnabled(bool).
public bool IsEnabled { get; init; }
Property Value
KeyFactory
A function that derives a QueryKey from the given args. Used to identify and share cache entries across queries with the same key.
public required Func<TArgs, QueryKey> KeyFactory { get; init; }
Property Value
RefetchInterval
Overrides the global RefetchInterval. null uses the global default.
public TimeSpan? RefetchInterval { get; init; }
Property Value
RetryHandler
Overrides the global RetryHandler. null uses the global default.
public IRetryHandler? RetryHandler { get; init; }
Property Value
StaleTime
Overrides the global StaleTime. null uses the global default.
public TimeSpan? StaleTime { get; init; }