Zeta.AspNetCore
0.1.17
dotnet add package Zeta.AspNetCore --version 0.1.17
NuGet\Install-Package Zeta.AspNetCore -Version 0.1.17
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="Zeta.AspNetCore" Version="0.1.17" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zeta.AspNetCore" Version="0.1.17" />
<PackageReference Include="Zeta.AspNetCore" />
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 Zeta.AspNetCore --version 0.1.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zeta.AspNetCore, 0.1.17"
#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 Zeta.AspNetCore@0.1.17
#: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=Zeta.AspNetCore&version=0.1.17
#tool nuget:?package=Zeta.AspNetCore&version=0.1.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Zeta
Zeta is a schema-first validation framework for .NET with a fluent, async-first API.
using Zeta;
var schema = Z.Schema<User>()
.Property(x => x.Email, s => s.Email())
.Property(x => x.Age, s => s.Min(18));
var result = await schema.ValidateAsync(new User("alice@example.com", 21));
if (!result.IsSuccess)
{
foreach (var error in result.Errors)
Console.WriteLine($"{error.PathString}: {error.Message}");
}
public sealed record User(string Email, int Age);
Quick Start
dotnet add package Zeta
# Optional: ASP.NET Core integration (Minimal APIs / Controllers)
dotnet add package Zeta.AspNetCore
# Optional: FastEndpoints integration
dotnet add package Zeta.FastEndpoints
Core Examples
1. Minimal API Validation
using Zeta;
using Zeta.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddZeta();
var app = builder.Build();
var createUserSchema = Z.Schema<CreateUserRequest>()
.Property(x => x.Email, s => s.Email())
.Property(x => x.Name, s => s.MinLength(2));
app.MapPost("/users", (CreateUserRequest request) => Results.Ok(request))
.WithValidation(createUserSchema);
app.Run();
public sealed record CreateUserRequest(string Email, string Name);
2. Context-Aware Rules with .Using(...)
var registerSchema = Z.Schema<RegisterRequest>()
.Using<RegisterContext>(async (input, sp, ct) =>
{
var repo = sp.GetRequiredService<IUserRepository>();
var exists = await repo.EmailExistsAsync(input.Email, ct);
return new RegisterContext(exists);
})
.Property(x => x.Email, s => s.Email())
.Refine((x, ctx) => !ctx.EmailExists, "Email already exists", "email_exists");
public sealed record RegisterRequest(string Email);
public sealed record RegisterContext(bool EmailExists);
3. Collection Validation with .Each(...)
var orderSchema = Z.Schema<CreateOrderRequest>()
.Property(x => x.Items, items => items
.Each(i => i
.Property(v => v.ProductId, s => s.NotEmpty())
.Property(v => v.Quantity, s => s.Min(1)))
.MinLength(1));
public sealed record CreateOrderRequest(List<OrderItem> Items);
public sealed record OrderItem(string ProductId, int Quantity);
This repository contains:
- Core package source:
src/Zeta - ASP.NET Core integration package source:
src/Zeta.AspNetCore - FastEndpoints integration package source:
src/Zeta.FastEndpoints - Source generators:
src/Zeta.SourceGenerators - Tests:
tests - Samples:
samples - Benchmarks:
benchmarks
Package Documentation
- Core validation package (
Zeta):src/Zeta/README.md - ASP.NET Core integration package (
Zeta.AspNetCore):src/Zeta.AspNetCore/README.md - FastEndpoints integration package (
Zeta.FastEndpoints):src/Zeta.FastEndpoints/README.md - Guides:
docs
Which package should I use?
Zeta: Use in any .NET app (Console, Worker, Blazor, MAUI, libraries).Zeta.AspNetCore: Add only when you need ASP.NET Core integration (Minimal APIs, Controllers, validation filters).Zeta.FastEndpoints: Add when you use FastEndpoints as your web framework.
Build and Test
dotnet build
dotnet test
Samples
# ASP.NET Core sample
dotnet run --project samples/Zeta.Sample.Api
# Blazor sample
dotnet run --project samples/Zeta.Sample.Blazor
# FastEndpoints sample
dotnet run --project samples/Zeta.Sample.FastEndpoints.Api
Benchmarks
Comparing Zeta against FluentValidation and DataAnnotations on .NET 10 (Apple M2 Pro).
Simple object (3 flat properties)
| Method | Mean | Allocated |
|---|---|---|
| FluentValidation | 137.6 ns | 600 B |
| FluentValidation (Async) | 236.3 ns | 672 B |
| Zeta | 287.6 ns | 72 B |
| Zeta (Invalid) | 515.9 ns | 1,424 B |
| DataAnnotations | 605.3 ns | 1,848 B |
| DataAnnotations (Invalid) | 1,015.9 ns | 2,672 B |
| FluentValidation (Invalid) | 1,913.6 ns | 7,312 B |
| FluentValidation (Invalid Async) | 2,068.4 ns | 7,384 B |
- Allocates 88% less memory than FluentValidation on valid input (72 B vs 600 B)
- 3.7x faster than FluentValidation when validation fails (516 ns vs 1,914 ns), with 5.1x less memory (1,424 B vs 7,312 B)
Complex object graph (nested object + collection of objects + conditional + cross-field rule)
A realistic e-commerce order: email, nested shipping address, a list of line items, a nullable discount code, and a cross-field total rule. DataAnnotations is excluded — TryValidateObject does not recurse into nested objects or collection elements.
| Method | Mean | Allocated |
|---|---|---|
| Zeta | 1.606 µs | 952 B |
| FluentValidation | 1.778 µs | 4,904 B |
| Zeta (Invalid) | 2.280 µs | 6,856 B |
| FluentValidation (Invalid) | 5.806 µs | 18,136 B |
- 5.1x less memory than FluentValidation on valid input (952 B vs 4,904 B)
- 2.5x faster than FluentValidation when validation fails (2.28 µs vs 5.81 µs), with 2.6x less memory (6,856 B vs 18,136 B)
Run benchmarks:
dotnet run --project benchmarks/Zeta.Benchmarks -c Release # all
dotnet run --project benchmarks/Zeta.Benchmarks -c Release -- --filter '*Complex*'
Changelog
See CHANGELOG.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
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 |
|---|---|---|
| 0.1.17 | 200 | 7/2/2026 |
| 0.1.16 | 202 | 3/1/2026 |
| 0.1.15 | 135 | 2/22/2026 |
| 0.1.14 | 135 | 2/19/2026 |
| 0.1.13 | 138 | 2/18/2026 |
| 0.1.12 | 140 | 2/17/2026 |
| 0.1.11 | 142 | 2/12/2026 |
| 0.1.10 | 147 | 2/11/2026 |
| 0.1.9 | 143 | 2/3/2026 |
| 0.1.8 | 142 | 1/29/2026 |
| 0.1.7 | 148 | 1/28/2026 |
| 0.1.6 | 147 | 1/27/2026 |
| 0.1.5 | 154 | 1/26/2026 |
| 0.1.4 | 147 | 1/24/2026 |
| 0.1.3 | 149 | 1/23/2026 |
| 0.1.2 | 149 | 1/23/2026 |