Axent.Abstractions
1.2.2
dotnet add package Axent.Abstractions --version 1.2.2
NuGet\Install-Package Axent.Abstractions -Version 1.2.2
<PackageReference Include="Axent.Abstractions" Version="1.2.2" />
<PackageVersion Include="Axent.Abstractions" Version="1.2.2" />
<PackageReference Include="Axent.Abstractions" />
paket add Axent.Abstractions --version 1.2.2
#r "nuget: Axent.Abstractions, 1.2.2"
#:package Axent.Abstractions@1.2.2
#addin nuget:?package=Axent.Abstractions&version=1.2.2
#tool nuget:?package=Axent.Abstractions&version=1.2.2
Axent
Axent is a source-generated CQRS library for modern .NET with typed pipelines and ASP.NET Core integration. It is currently ~2x faster than MediatR (v12.5) with fewer allocations.
Why Axent?
- 🚀 Fast: source generated dispatch with zero reflection
- 🧩 Minimal: very little setup
- 🧠 Strongly typed, extensible pipelines for cross-cutting concerns
- 🌐 First class ASP.NET Core integration
- ⚙️ Built for modern .NET (8+)
📦 Features
- Minimal setup and boilerplate
- Source-generated dispatch — no reflection at runtime
- Typed pipelines with support for generic and request-specific pipes
- Separate marker interfaces for commands and queries (
ICommand<TResponse>,IQuery<TResponse>) - Built-in support for transactions, logging, and error handling via pipeline options
- ASP.NET Core integration
- .NET 8+ optimized
Prerequisites
- .NET 8 or later
🚀 Getting Started
1. Install Packages
dotnet add package Axent.Core
dotnet add package Axent.Extensions.AspNetCore
2. Register Services
builder.Services.AddAxent()
.AddRequestHandlers(AssemblyProvider.Current);
3. Create a Request and Handler
- IQuery<TResponse> for read operations
- ICommand<TResponse> for write operations
- IRequest<TResponse> if you don't want to differentiate
- IRequestHandler<TRequest, TResponse> to handle them
using Axent.Abstractions;
namespace Axent.ExampleApi;
internal sealed class ExampleQuery : IQuery
{
public required string Message { get; init; }
}
internal sealed class ExampleQueryHandler : IRequestHandler
{
private readonly ILogger _logger;
public ExampleQueryHandler(ILogger logger)
{
_logger = logger;
}
public ValueTask<Response> HandleAsync(RequestContext context, CancellationToken cancellationToken = default)
{
_logger.LogInformation("Message from request '{Message}'", context.Request.Message);
return ValueTask.FromResult(Response.Success(Unit.Value));
}
}
4. Send a Request
Inject ISender into endpoints or application services.
app.MapGet("/api/example", async (ISender sender, CancellationToken cancellationToken) =>
{
var response = await sender.SendAsync(new ExampleQuery { Message = "Hello World!" }, cancellationToken);
return response.ToResult();
});
Alternatively using the template
dotnet new install Axent.Templates
dotnet new axent-api
📖 Docs
To learn more about the features of Axent, checkout the documentation
📊 Benchmarks
Axent (Source Generated Dispatch)
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26200.7840)
Unknown processor
.NET SDK 10.0.200-preview.0.26103.119
[Host] : .NET 8.0.23 (8.0.2325.60607), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI [AttachedDebugger]
DefaultJob : .NET 8.0.23 (8.0.2325.60607), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|---|
| 'SendAsync (cold)' | 36.74 ns | 0.741 ns | 1.702 ns | 1.00 | 0.06 | 0.0196 | 328 B | 1.00 |
| 'SendAsync (warm, same instance)' | 33.97 ns | 0.423 ns | 0.353 ns | 0.93 | 0.04 | 0.0181 | 304 B | 0.93 |
MediatR (v12.5.0)
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26200.7840)
Unknown processor
.NET SDK 10.0.200-preview.0.26103.119
[Host] : .NET 8.0.23 (8.0.2325.60607), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI [AttachedDebugger]
DefaultJob : .NET 8.0.23 (8.0.2325.60607), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| 'Send (cold)' | 79.03 ns | 1.526 ns | 2.713 ns | 0.0257 | 432 B |
| 'Send (warm, same instance)' | 79.21 ns | 1.566 ns | 3.783 ns | 0.0243 | 408 B |
🤝 Contributing
Contributions are welcome. If you find a bug, have an improvement, or want to propose a feature:
- Open an issue
- Start a discussion
- Submit a pull request
📄 License
This project is licensed under the Apache License 2.0. See LICENSE for details.
| 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 was computed. 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 was computed. 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. |
-
net8.0
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Axent.Abstractions:
| Package | Downloads |
|---|---|
|
Axent.Core
A simple performance focused CQRS library. |
|
|
Axent.Extensions.AspNetCore
A simple performance focused CQRS library. |
|
|
Axent.Extensions.FluentValidation
A simple performance focused CQRS library. |
|
|
Axent.Extensions.Authorization
A simple performance focused CQRS library. |
|
|
Axent.Extensions.Caching
A simple performance focused CQRS library. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.2 | 185 | 3/9/2026 |
| 1.2.1 | 143 | 3/9/2026 |
| 1.2.1-alpha.2 | 52 | 3/8/2026 |
| 1.2.1-alpha.1 | 56 | 3/8/2026 |
| 1.2.0 | 125 | 3/8/2026 |
| 1.1.0 | 126 | 2/28/2026 |
| 1.1.0-alpha.3 | 44 | 2/28/2026 |
| 1.1.0-alpha.2 | 49 | 2/28/2026 |
| 1.0.1 | 120 | 2/26/2026 |
| 1.0.0 | 120 | 2/25/2026 |
| 0.0.1 | 117 | 2/25/2026 |