CaeriusNet 11.2.0

dotnet add package CaeriusNet --version 11.2.0
                    
NuGet\Install-Package CaeriusNet -Version 11.2.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="CaeriusNet" Version="11.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CaeriusNet" Version="11.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CaeriusNet" />
                    
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 CaeriusNet --version 11.2.0
                    
#r "nuget: CaeriusNet, 11.2.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 CaeriusNet@11.2.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=CaeriusNet&version=11.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CaeriusNet&version=11.2.0
                    
Install as a Cake Tool

CaeriusNet

CaeriusNet is the .NET 10 / C# 14 runtime for SQL Server 2022 and 2025 stored procedures. Building v12 requires SDK 10.0.400 with patch roll-forward and Roslyn 5.9 or later. It provides dependency-injection registration, typed mapping, TVPs, explicit result cardinalities, transactions, local cache managers, BCL telemetry, the DTO/TVP generator, and the analyzer.

Install

dotnet add package CaeriusNet --version 11.2.0

Quick start

using CaeriusNet;
using CaeriusNet.Abstractions;
using CaeriusNet.Commands;
using CaeriusNet.Mappers;
using Microsoft.Data.SqlClient;

services.AddCaeriusNet(options => options.UseSqlServer(connectionString));

public sealed record Product(int Id, string Name) : ISpMapper<Product>
{
    public static Product MapFromDataReader(SqlDataReader reader) =>
        new(reader.GetInt32(0), reader.GetString(1));
}

var command = new StoredProcedureCommandBuilder("dbo", "usp_Product_Get")
    .AddParameter("Id", productId, SqlDbType.Int)
    .Build();

var product = await database.QuerySingleAsync<Product>(command, cancellationToken);

StoredProcedureCommand is immutable once built. Inputs, directions, ordinals, SQL facets and TVP metadata are validated before a connection is opened; parameters are created directly with their declared SqlDbType—never with AddWithValue.

Named databases

services.AddCaeriusNet("reporting", options => options.UseSqlServer(reportingConnectionString));

public sealed class ReportService(
    [FromKeyedServices("reporting")] ICaeriusNetDbContext reporting)
{
}

Runtime model

  • Stored procedures only: each command uses CommandType.StoredProcedure; inline SQL is unsupported.
  • Cardinality APIs distinguish no row, DBNull, multiple rows and conversion failures.
  • QueryAsync<T> is materialized even though it returns IEnumerable<T>; use StreamAsync<T> for an explicitly scoped single-result stream.
  • Multi-result APIs cover 2–10 sets and all three materialized families. Result-set count is exact unless a CaeriusResultSetCountPolicy explicitly permits variation.
  • [GenerateDto] and [GenerateTvp] generate mapping and typed-cache-codec support. [GenerateTvp] accepts a sealed positional record class or a readonly positional record struct; a manual TVP declares exact metadata with SqlServerTvpColumnAttribute on every positional parameter. Manual Redis-cached result types must implement and register ICaeriusCacheCodec<T>.
  • Memory cache is TTL/sliding and single-flight; Frozen cache is an atomically swapped snapshot and never rebuilds on a miss.
  • Redis cache keys are isolated by a non-secret database identity. UseSqlServer(string) derives it from the endpoint/catalog; connection or lease factories must set CacheDatabaseIdentity explicitly. Redis read-through collapses concurrent lookup, SQL fallback and population per canonical key in each host. Keys use the stable caerius:v2:<sha256> form and cache dependencies are declared with DependsOn(...); durable writes target them with Invalidates(...).
  • The replayable TVP overload takes IReadOnlyCollection<T>; the streaming overload takes Func<CancellationToken, IEnumerable<T>>, is not materialized and makes the command non-cacheable.
  • Transactions use one connection, reject concurrent commands, bypass read-through cache and run invalidations after a successful commit. Their materialized and multi-result APIs have output-aware counterparts; outputs are observed only after readers are fully consumed. transaction.StreamAsync<T> owns the transaction command slot until enumeration ends, and an incomplete enumeration requires rollback. A commit or rollback token is observed before the terminal SQL operation begins; after that point CaeriusNet completes the terminal operation and post-commit invalidations without caller cancellation, so an aborted request cannot leave a durable write behind a stale cache entry. If a completed write cannot invalidate cache data, CaeriusCacheInvalidationException.SqlWasCommitted is true; reconcile instead of blindly retrying a non-idempotent procedure.

CaeriusNet.Redis, CaeriusNet.Aspire, and CaeriusNet.Contracts are separate packages. See the repository README, migration guide, documentation, and issue tracker.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on CaeriusNet:

Package Downloads
CaeriusNet.Redis

Async Redis cache integration for CaeriusNet with typed AOT-safe codecs and a versioned binary envelope.

CaeriusNet.Contracts

SQL Server AutoContracts discovery tool, manifest integration, and opt-in buildTransitive targets for CaeriusNet.

CaeriusNet.Aspire

.NET Aspire SQL Server and Redis integration for CaeriusNet with health checks and OpenTelemetry wiring.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.2.0 42 8/21/2026
11.1.2 125 8/3/2026
11.1.1 138 7/6/2026
11.1.0 134 5/15/2026
11.0.3 130 4/28/2026
11.0.2 122 4/26/2026
11.0.1 117 4/21/2026
11.0.0 115 4/20/2026
10.3.0 115 4/19/2026
10.2.1 113 4/19/2026
10.1.3 139 2/20/2026
10.1.2 293 1/22/2026
10.1.0 277 12/19/2025
10.0.1 226 12/5/2025
10.0.0.8-alpha 194 11/2/2025
10.0.0.7-alpha 194 10/29/2025
10.0.0.6-alpha 186 10/29/2025
10.0.0.5-alpha 198 10/29/2025
10.0.0.4-alpha 195 10/28/2025
10.0.0 339 11/12/2025
Loading failed