CaeriusNet 10.3.0
See the version list below for details.
dotnet add package CaeriusNet --version 10.3.0
NuGet\Install-Package CaeriusNet -Version 10.3.0
<PackageReference Include="CaeriusNet" Version="10.3.0" />
<PackageVersion Include="CaeriusNet" Version="10.3.0" />
<PackageReference Include="CaeriusNet" />
paket add CaeriusNet --version 10.3.0
#r "nuget: CaeriusNet, 10.3.0"
#:package CaeriusNet@10.3.0
#addin nuget:?package=CaeriusNet&version=10.3.0
#tool nuget:?package=CaeriusNet&version=10.3.0
CaeriusNet
High-performance micro-ORM for C# 14 / .NET 10 that executes SQL Server Stored Procedures, maps DTOs at compile-time, passes Table-Valued Parameters, and caches results — all in a single package, zero reflection at runtime.
Installation
dotnet add package CaeriusNet
Prerequisites
- .NET 10 or later
- SQL Server 2019 or later
Quick Start
1. Configure (Program.cs)
// Standard
CaeriusNetBuilder.Create(services)
.WithSqlServer("Server=.;Database=MyDb;Trusted_Connection=True;")
.Build();
// .NET Aspire
CaeriusNetBuilder.Create(builder)
.WithAspireSqlServer("CaeriusNet")
.WithAspireRedis()
.Build();
2. Define a DTO
Source-generated (recommended):
[GenerateDto]
public sealed partial record ProductDto(int Id, string Name, decimal Price);
// Generates: ISpMapper<ProductDto> with MapFromDataReader at compile-time
Manual:
public sealed record ProductDto(int Id, string Name, decimal Price) : ISpMapper<ProductDto>
{
public static ProductDto MapFromDataReader(SqlDataReader reader)
=> new(reader.GetInt32(0), reader.GetString(1), reader.GetDecimal(2));
}
3. Execute a Stored Procedure
var sp = new StoredProcedureParametersBuilder("dbo", "sp_GetProducts", capacity: 1)
.AddParameter("CategoryId", categoryId, SqlDbType.Int)
.Build();
IReadOnlyCollection<ProductDto> products =
await dbContext.QueryAsReadOnlyCollectionAsync<ProductDto>(sp, ct);
Table-Valued Parameters (TVP)
Source-generated:
[GenerateTvp(Schema = "dbo", TvpName = "tvp_int")]
public sealed partial record IntTvp(int Value);
Manual:
public sealed record OrderLineDto(int ProductId, int Qty) : ITvpMapper<OrderLineDto>
{
public static string TvpTypeName => "dbo.tvp_OrderLine";
public static IEnumerable<SqlDataRecord> MapAsSqlDataRecords(IEnumerable<OrderLineDto> items)
{
var meta = new[] { new SqlMetaData("ProductId", SqlDbType.Int), new SqlMetaData("Qty", SqlDbType.Int) };
foreach (var item in items)
{
var record = new SqlDataRecord(meta);
record.SetInt32(0, item.ProductId);
record.SetInt32(1, item.Qty);
yield return record;
}
}
}
Usage:
var sp = new StoredProcedureParametersBuilder("dbo", "sp_BulkInsert", capacity: 1)
.AddTvpParameter("OrderLines", orderLines)
.Build();
await dbContext.ExecuteNonQueryAsync(sp, ct);
Caching
var sp = new StoredProcedureParametersBuilder("dbo", "sp_GetProducts", capacity: 2)
.AddParameter("CategoryId", categoryId, SqlDbType.Int)
.AddFrozenCache("products:all") // immutable, process-lifetime
// .AddInMemoryCache("products:all", TimeSpan.FromMinutes(5))
// .AddRedisCache("products:all", TimeSpan.FromMinutes(5))
.Build();
Write Operations
var sp = new StoredProcedureParametersBuilder("dbo", "sp_CreateProduct", capacity: 2)
.AddParameter("Name", name, SqlDbType.NVarChar)
.AddParameter("Price", price, SqlDbType.Decimal)
.Build();
await dbContext.ExecuteNonQueryAsync(sp, ct);
// Or retrieve a scalar return value
int newId = await dbContext.ExecuteScalarAsync<int>(sp, ct);
Multi-Result Sets
var sp = new StoredProcedureParametersBuilder("dbo", "sp_GetDashboard", capacity: 0).Build();
(IEnumerable<ProductDto> products, IEnumerable<CategoryDto> categories) =
await dbContext.QueryMultipleIEnumerableAsync<ProductDto, CategoryDto>(sp, ct);
Supported up to 5 result sets: QueryMultipleIEnumerableAsync<T1,T2> through
QueryMultipleIEnumerableAsync<T1,T2,T3,T4,T5>.
Available Query Methods
| Method | Returns |
|---|---|
QueryAsReadOnlyCollectionAsync<T> |
IReadOnlyCollection<T> |
QueryAsIEnumerableAsync<T> |
IEnumerable<T> |
QueryAsImmutableArrayAsync<T> |
ImmutableArray<T> |
FirstQueryAsync<T> |
T (first row) |
ExecuteNonQueryAsync |
void |
ExecuteAsync |
void |
ExecuteScalarAsync<T> |
T |
Documentation
Full documentation, samples, and API reference: https://caerius.net
Source code & releases: https://github.com/CaeriusNET/CaeriusNet
License
MIT
| 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
- Aspire.Microsoft.Data.SqlClient (>= 13.2.2)
- Aspire.StackExchange.Redis.DistributedCaching (>= 13.2.2)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.Extensions.Caching.Memory (>= 10.0.6)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 10.0.6)
- Microsoft.Extensions.Configuration.Json (>= 10.0.6)
- Microsoft.Extensions.DependencyInjection (>= 10.0.6)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.6)
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 | |
|---|---|---|---|
| 11.0.1 | 45 | 4/21/2026 | |
| 11.0.0 | 83 | 4/20/2026 | |
| 10.3.0 | 84 | 4/19/2026 | |
| 10.2.1 | 80 | 4/19/2026 | |
| 10.1.3 | 115 | 2/20/2026 | |
| 10.1.2 | 264 | 1/22/2026 | |
| 10.1.0 | 252 | 12/19/2025 | |
| 10.0.1 | 203 | 12/5/2025 | |
| 10.0.0.8-alpha | 169 | 11/2/2025 | |
| 10.0.0.7-alpha | 169 | 10/29/2025 | |
| 10.0.0.6-alpha | 163 | 10/29/2025 | |
| 10.0.0.5-alpha | 174 | 10/29/2025 | |
| 10.0.0.4-alpha | 168 | 10/28/2025 | |
| 10.0.0.3-alpha | 160 | 10/28/2025 | |
| 10.0.0.2-alpha | 166 | 10/27/2025 | |
| 10.0.0.1-alpha | 112 | 10/25/2025 | |
| 10.0.0 | 309 | 11/12/2025 | |
| 10.0.0-alpha | 244 | 10/21/2025 | |
| 9.4.1 | 233 | 9/5/2025 | |
| 9.4.0 | 316 | 9/3/2025 |
See https://github.com/CaeriusNET/CaeriusNet/releases for release notes.