Axent.Extensions.AspNetCore
4.0.0
dotnet add package Axent.Extensions.AspNetCore --version 4.0.0
NuGet\Install-Package Axent.Extensions.AspNetCore -Version 4.0.0
<PackageReference Include="Axent.Extensions.AspNetCore" Version="4.0.0" />
<PackageVersion Include="Axent.Extensions.AspNetCore" Version="4.0.0" />
<PackageReference Include="Axent.Extensions.AspNetCore" />
paket add Axent.Extensions.AspNetCore --version 4.0.0
#r "nuget: Axent.Extensions.AspNetCore, 4.0.0"
#:package Axent.Extensions.AspNetCore@4.0.0
#addin nuget:?package=Axent.Extensions.AspNetCore&version=4.0.0
#tool nuget:?package=Axent.Extensions.AspNetCore&version=4.0.0
Axent
Axent is a source-generated CQRS library for modern .NET with typed pipelines and ASP.NET Core integration.
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()
.AddRequestHandlersFromAssemblyContaining<ExampleQueryHandler>();
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.Models;
using Axent.Abstractions.Requests;
using Axent.Abstractions.Services;
namespace Axent.ExampleApi;
[Axent]
internal sealed record ExampleQuery(string Message) : IQuery<Unit>;
internal sealed class ExampleQueryHandler : IRequestHandler<ExampleQuery, Unit>
{
private readonly ILogger<ExampleQueryHandler> _logger;
public ExampleQueryHandler(ILogger<ExampleQueryHandler> logger)
{
_logger = logger;
}
public ValueTask<Response<Unit>> HandleAsync(ExampleQuery request, CancellationToken cancellationToken = default)
{
_logger.LogInformation("Message from request '{Message}'", request.Message);
return ValueTask.FromResult(Response.Success(Unit.Value));
}
}
4. Send a Request
Inject IRequestSender<TRequest, TResponse> into endpoints or application services for the generated typed fast path.
app.MapGet("/api/example", async (IRequestSender<ExampleQuery, Unit> sender, CancellationToken cancellationToken) =>
{
var response = await sender.SendAsync(new ExampleQuery("Hello World!"), cancellationToken);
return response.ToResult();
});
ISender is still available for dynamic dispatch, but it is a compatibility adapter over generated typed senders and is not the recommended hot path.
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.8655)
Unknown processor
.NET SDK 11.0.100-preview.5.26302.115
[Host] : .NET 10.0.9 (10.0.926.27113), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI [AttachedDebugger]
DefaultJob : .NET 10.0.9 (10.0.926.27113), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|---|
| 'SendAsync (cold)' | 16.46 ns | 0.524 ns | 1.536 ns | 1.01 | 0.13 | 0.0105 | 176 B | 1.00 |
| 'SendAsync (warm, same instance)' | 14.10 ns | 0.266 ns | 0.337 ns | 0.86 | 0.08 | 0.0091 | 152 B | 0.86 |
MediatR (v12.5.0)
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26200.8655)
Unknown processor
.NET SDK 11.0.100-preview.5.26302.115
[Host] : .NET 10.0.9 (10.0.926.27113), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI [AttachedDebugger]
DefaultJob : .NET 10.0.9 (10.0.926.27113), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| 'Send (cold)' | 49.26 ns | 0.941 ns | 1.813 ns | 0.0191 | 320 B |
| 'Send (warm, same instance)' | 47.44 ns | 0.983 ns | 2.115 ns | 0.0176 | 296 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 | 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
- Axent.Abstractions (>= 4.0.0)
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 |
|---|---|---|
| 4.0.0 | 115 | 6/19/2026 |
| 4.0.0-alpha.1 | 181 | 6/17/2026 |
| 3.0.1 | 108 | 6/17/2026 |
| 3.0.0 | 149 | 5/21/2026 |
| 3.0.0-alpha.1 | 58 | 5/21/2026 |
| 2.0.2 | 120 | 5/13/2026 |
| 2.0.1 | 145 | 5/8/2026 |
| 2.0.0 | 131 | 5/6/2026 |
| 2.0.0-alpha.1 | 65 | 5/6/2026 |
| 1.2.2 | 249 | 3/9/2026 |
| 1.2.1 | 137 | 3/9/2026 |
| 1.2.1-alpha.2 | 76 | 3/8/2026 |
| 1.2.1-alpha.1 | 73 | 3/8/2026 |
| 1.2.0 | 127 | 3/8/2026 |
| 1.1.0 | 126 | 2/28/2026 |
| 1.1.0-alpha.3 | 72 | 2/28/2026 |
| 1.1.0-alpha.2 | 76 | 2/28/2026 |
| 1.0.1 | 120 | 2/26/2026 |
| 1.0.0 | 117 | 2/25/2026 |
| 0.0.1 | 117 | 2/25/2026 |