Fetchling.Blazor 3.0.0

Prefix Reserved
dotnet add package Fetchling.Blazor --version 3.0.0
                    
NuGet\Install-Package Fetchling.Blazor -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fetchling.Blazor" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fetchling.Blazor" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Fetchling.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fetchling.Blazor --version 3.0.0
                    
#r "nuget: Fetchling.Blazor, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fetchling.Blazor@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fetchling.Blazor&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Fetchling.Blazor&version=3.0.0
                    
Install as a Cake Tool

Fetchling

GitHub Actions Workflow Status Codecov (with branch) NuGet Version GitHub License

A TanStack Query-inspired async data fetching and state management library for .NET and Blazor.

Formerly DotNetQuery. Fetchling is the same library, renamed for 3.0. The DotNetQuery.* packages stay on 2.x and get no further releases. To upgrade, switch each DotNetQuery.* package to its Fetchling.* counterpart and replace DotNetQuery with Fetchling in namespaces and in AddDotNetQuery().

Fetchling brings the battle-tested data-fetching patterns of TanStack Query to the .NET ecosystem. It gives you predictable loading, error, and success states out of the box — powered by Rx.NET observables, so everything is composable, lazy, and reactive by default.

Table of Contents

Features

  • Queries — fetch async data with automatic caching, background refetching, and stale-while-revalidate semantics
  • Infinite queries — paginated and "load more" data fetching with <InfiniteSuspense> / <InfiniteTransition>
  • Streamed queries — fold an IAsyncEnumerable (gRPC streams, LLM tokens, SignalR or server-sent events) into data that renders as it grows
  • Mutations — execute data-modifying operations with lifecycle callbacks, progress reporting, and automatic cache invalidation on success
  • Live data — keep the cache current from server pushes: invalidate on an event, or write the pushed data straight in with IQueryClient.SetData
  • Reactive state — built on Rx.NET, every query and mutation exposes IObservable streams for composable async pipelines
  • Smart caching — configurable stale time and cache time control when data is re-fetched and when it is evicted
  • Query deduplication — identical keys share a single cached query instance; no redundant requests
  • Retry logic — one attempt by default, fail-fast; plug in exponential backoff or any other policy via IRetryHandler
  • Observability — OTel-compatible distributed tracing (ActivitySource), metrics (Meter), and structured logging (ILogger) using only BCL APIs; no OpenTelemetry package required in the library
  • Blazor components — <Suspense> and <Transition> components for declarative query rendering
  • DevTools — <QueryDevTools> live cache inspector component for development, and a public inspection API for building your own
  • MVVM view models — QueryViewModel<TArgs, TData> with bindable INotifyPropertyChanged properties and UI-thread marshaling for MAUI, WPF, WinUI, UNO Platform, and Avalonia
  • CSR / SSR support — QueryExecutionMode controls Singleton (WebAssembly) vs Scoped (Server-Side Rendering) DI lifetime
  • DI integration — first-class support for Microsoft.Extensions.DependencyInjection

Installation

# Core + DI integration in one package — the usual starting point
dotnet add package Fetchling

# Core library — always required
dotnet add package Fetchling.Core

# DI integration
dotnet add package Fetchling.Extensions.DependencyInjection

# Blazor components
dotnet add package Fetchling.Blazor

# Blazor DevTools — live cache inspector for development
dotnet add package Fetchling.Blazor.DevTools

# MVVM view models (MAUI, WPF, WinUI, UNO, Avalonia)
dotnet add package Fetchling.Mvvm

Documentation

Full guides, examples, and API reference are available here.

AI agents / LLMs: a single-file reference covering the full public API, all patterns, and architecture notes is available at /llms.txt. The docs are also indexed on Context7 under the library ID /psachmann/fetchling.

Quick Start

// Program.cs
builder.Services.AddFetchling(options =>
{
    options.StaleTime = TimeSpan.FromMinutes(1);
});
// Create a query
var query = queryClient.CreateQuery(new QueryOptions<int, UserDto>
{
    KeyFactory = id => QueryKey.From("users", id),
    Fetcher    = (id, ct) => userService.GetByIdAsync(id, ct),
});

query.SetArgs(42);

query.Success.Subscribe(user => Console.WriteLine($"Hello, {user.Name}!"));
query.Failure.Subscribe(error => Console.WriteLine($"Oops: {error.Message}"));
// Create a mutation
var mutation = queryClient.CreateMutation(new MutationOptions<CreateUserRequest, UserDto>
{
    Mutator        = (req, ct) => userService.CreateAsync(req, ct),
    InvalidateKeys = [QueryKey.From("users")],
    OnSuccess      = (_, user) => Console.WriteLine($"Created {user.Name}"),
});

mutation.Execute(new CreateUserRequest { Name = "Alice" });

<Suspense Query="query">
    <Content Context="user"><p>Hello, @user.Name!</p></Content>
    <Loading><p>Loading...</p></Loading>
    <Failure Context="error"><p>Error: @error.Message</p></Failure>
</Suspense>

Contributing

Contributions are welcome! Please see the Contributing guide for setup instructions, coding conventions, and the PR workflow. For bugs and feature requests, open an issue.

License

MIT — Copyright (c) 2026 Patrick Sachmann

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 110 11/16/2026
3.0.0-beta.8 61 11/14/2026
3.0.0-beta.6 69 11/14/2026