CaeriusNet 11.2.0
dotnet add package CaeriusNet --version 11.2.0
NuGet\Install-Package CaeriusNet -Version 11.2.0
<PackageReference Include="CaeriusNet" Version="11.2.0" />
<PackageVersion Include="CaeriusNet" Version="11.2.0" />
<PackageReference Include="CaeriusNet" />
paket add CaeriusNet --version 11.2.0
#r "nuget: CaeriusNet, 11.2.0"
#:package CaeriusNet@11.2.0
#addin nuget:?package=CaeriusNet&version=11.2.0
#tool nuget:?package=CaeriusNet&version=11.2.0
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 returnsIEnumerable<T>; useStreamAsync<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
CaeriusResultSetCountPolicyexplicitly 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 withSqlServerTvpColumnAttributeon every positional parameter. Manual Redis-cached result types must implement and registerICaeriusCacheCodec<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 setCacheDatabaseIdentityexplicitly. Redis read-through collapses concurrent lookup, SQL fallback and population per canonical key in each host. Keys use the stablecaerius:v2:<sha256>form and cache dependencies are declared withDependsOn(...); durable writes target them withInvalidates(...). - The replayable TVP overload takes
IReadOnlyCollection<T>; the streaming overload takesFunc<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.SqlWasCommittedistrue; 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 | Versions 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. |
-
net10.0
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.Extensions.Caching.Memory (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
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 |