Fetchling 3.0.0-beta.8

Prefix Reserved
This is a prerelease version of Fetchling.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Fetchling --version 3.0.0-beta.8
                    
NuGet\Install-Package Fetchling -Version 3.0.0-beta.8
                    
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" Version="3.0.0-beta.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fetchling" Version="3.0.0-beta.8" />
                    
Directory.Packages.props
<PackageReference Include="Fetchling" />
                    
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 --version 3.0.0-beta.8
                    
#r "nuget: Fetchling, 3.0.0-beta.8"
                    
#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@3.0.0-beta.8
                    
#: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&version=3.0.0-beta.8&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Fetchling&version=3.0.0-beta.8&prerelease
                    
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>
  • Mutations — execute data-modifying operations with lifecycle callbacks and automatic cache invalidation on success
  • 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
  • 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

There are no supported framework assets in this 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 111 11/16/2026
3.0.0-beta.8 69 11/14/2026
3.0.0-beta.6 73 11/14/2026