Table of Contents

Interface IQuery<TArgs, TData>

Namespace
DotNetQuery.Core
Assembly
DotNetQuery.Core.dll

A query that fetches data using the provided TArgs. Inherits all lifecycle members from IQuery.

public interface IQuery<TArgs, TData> : IQuery, IDisposable

Type Parameters

TArgs

The type of the parameters passed to the fetcher.

TData

The type of the data returned by the fetcher.

Inherited Members

Properties

CurrentState

The current state snapshot. Can be read synchronously without subscribing.

QueryState<TData> CurrentState { get; }

Property Value

QueryState<TData>

Failure

Emits the Exception on each failed fetch.

IObservable<Exception> Failure { get; }

Property Value

IObservable<Exception>

Settled

Emits the final QueryState<TData> after each fetch completes, regardless of whether it succeeded or failed. Useful for hiding loading indicators.

IObservable<QueryState<TData>> Settled { get; }

Property Value

IObservable<QueryState<TData>>

State

Emits on every state transition (e.g. Idle → Fetching → Success/Failed). Replays the latest state to new subscribers.

IObservable<QueryState<TData>> State { get; }

Property Value

IObservable<QueryState<TData>>

Success

Emits the unwrapped TData on each successful fetch.

IObservable<TData> Success { get; }

Property Value

IObservable<TData>

Methods

Detach()

Removes this query from the client cache while keeping active subscriptions alive. Use Dispose() to also tear down all subscriptions and release resources.

void Detach()

SetArgs(TArgs)

Sets the args that drive the next fetch. When args change, the query switches to the cache entry for the newly derived key and triggers a fetch if the query is enabled.

void SetArgs(TArgs args)

Parameters

args TArgs

SetEnabled(bool)

Enables or disables the query. When false, fetching is suspended even if the query is invalidated or new args are pushed. Pass true to resume; the query will immediately re-evaluate its active key and trigger a fetch if one is pending.

void SetEnabled(bool enabled)

Parameters

enabled bool