Table of Contents

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

TArgs

The type of the arguments passed to the fetcher.

TData

The 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

TimeSpan?

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

bool

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

Func<TArgs, QueryKey>

RefetchInterval

Overrides the global RefetchInterval. null uses the global default.

public TimeSpan? RefetchInterval { get; init; }

Property Value

TimeSpan?

RetryHandler

Overrides the global RetryHandler. null uses the global default.

public IRetryHandler? RetryHandler { get; init; }

Property Value

IRetryHandler

StaleTime

Overrides the global StaleTime. null uses the global default.

public TimeSpan? StaleTime { get; init; }

Property Value

TimeSpan?