Axent.Core 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Axent.Core --version 1.0.0
                    
NuGet\Install-Package Axent.Core -Version 1.0.0
                    
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="Axent.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Axent.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Axent.Core" />
                    
Project file
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 Axent.Core --version 1.0.0
                    
#r "nuget: Axent.Core, 1.0.0"
                    
#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 Axent.Core@1.0.0
                    
#: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=Axent.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Axent.Core&version=1.0.0
                    
Install as a Cake Tool

Axent

NuGet NuGet NuGet License

Axent is a lightweight, high-performance .NET library for implementing CQRS patterns with minimal boilerplate. It provides a simple request/response pipeline and allows adding custom processors for advanced scenarios.


Features

  • Minimal setup for CQRS in .NET applications
  • Request/response handling with RequestHandler<TRequest, TResponse>
  • Extensible pipelines using IAxentPipe<TRequest, TResponse>
  • Optimized for performance and simplicity
  • Works seamlessly with ASP.NET Core

Prerequisites

  • .NET 8 or later

Getting started

1. Install Packages

dotnet add package Axent.Core --version 0.0.1
dotnet add package Axent.Extensions.AspNetCore --version 0.0.1

2. Register Services

builder.Services.AddHttpContextAccessor()
builder.Services.AddAxent()
    .AddRequestHandlers(AssemblyProvider.Current);

3. Implement a Request Handler

Example showing a request that logs a message

using Axent.Abstractions;
using Axent.Core;

namespace Axent.ExampleApi;

internal sealed class ExampleRequest : IRequest<Unit>
{
    public required string Message { get; init; }
}

internal sealed class ExampleRequestHandler : RequestHandler<ExampleRequest, Unit>
{
    private readonly ILogger<ExampleRequestHandler> _logger;

    public ExampleRequestHandler(ILogger<ExampleRequestHandler> logger)
    {
        _logger = logger;
    }

    public override Task<Response<Unit>> HandleAsync(RequestContext<ExampleRequest> context, CancellationToken cancellationToken = default)
    {
        _logger.LogInformation("Message from request '{0}'", context.Request.Message);
        return Task.FromResult(Response<Unit>.Success(Unit.Value));
    }
}

4. Call the Request Handler in an API Endpoint

app.MapGet("/api/example", async (ISender sender, CancellationToken cancellationToken) =>
{
    var request = new ExampleRequest
    {
        Message = "Hello World!"
    };

    var response = await sender.SendAsync(request, cancellationToken);
    return response.ToResult();
});

Pipelines

Axent allows you to add custom processors to your request pipeline by implementing IAxentPipe<TRequest, TResponse>. This is useful for logging, validation, metrics, or any cross-cutting concerns.

Example Pipe

internal sealed class ExampleRequestPipe<TRequest, TResponse> : IAxentPipe<TRequest, TResponse>
{
    private readonly ILogger<ExampleRequestPipe<TRequest, TResponse>> _logger;

    public ExampleRequestPipe(ILogger<ExampleRequestPipe<TRequest, TResponse>> logger)
    {
        _logger = logger;
    }
    
    public ValueTask<Response<TResponse>> ProcessAsync(Func<ValueTask<Response<TResponse>>> next, RequestContext<TRequest> context, CancellationToken cancellationToken = default)
    {
        _logger.LogInformation("This pipe runs during every request.");
        return next();
    }
}

This pipe executes for every request handled by Axent.

Contributing

Contributions are welcome! Please open an issue or pull request for bug fixes, improvements, or new features.

License

This project is licensed under the Apache License.

Product 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. 
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
1.2.2 102 3/9/2026
1.2.1 126 3/9/2026
1.2.1-alpha.2 53 3/8/2026
1.2.1-alpha.1 50 3/8/2026
1.2.0 113 3/8/2026
1.1.0 110 2/28/2026
1.1.0-alpha.3 45 2/28/2026
1.1.0-alpha.2 50 2/28/2026
1.0.1 103 2/26/2026
1.0.0 102 2/25/2026
0.0.1 102 2/25/2026