Koto.Api.AspNetCore 0.3.0-preview.3

This is a prerelease version of Koto.Api.AspNetCore.
dotnet add package Koto.Api.AspNetCore --version 0.3.0-preview.3
                    
NuGet\Install-Package Koto.Api.AspNetCore -Version 0.3.0-preview.3
                    
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="Koto.Api.AspNetCore" Version="0.3.0-preview.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Koto.Api.AspNetCore" Version="0.3.0-preview.3" />
                    
Directory.Packages.props
<PackageReference Include="Koto.Api.AspNetCore" />
                    
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 Koto.Api.AspNetCore --version 0.3.0-preview.3
                    
#r "nuget: Koto.Api.AspNetCore, 0.3.0-preview.3"
                    
#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 Koto.Api.AspNetCore@0.3.0-preview.3
                    
#: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=Koto.Api.AspNetCore&version=0.3.0-preview.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Koto.Api.AspNetCore&version=0.3.0-preview.3&prerelease
                    
Install as a Cake Tool

Koto.Api.AspNetCore

Transport-agnostic ASP.NET Core integration for Koto results: map Result<T> to HTTP responses from Minimal APIs, MVC controllers, or any other ASP.NET Core host. Koto.Api.FastEndpoints builds on this package.

What you get

  • ToHttpResult() / ToHttpResultAsync()Result<T>IResult (Minimal API)
  • ToActionResult() / ToActionResultAsync()Result<T>ActionResult<T> (MVC)
  • KotoProblemDetails — RFC 7807 Problem Details from one or many Errors (multiple errors become validation problem details with an errors dictionary per field)
  • KotoHttpErrorOptions — extensible Error.Code → HTTP status registry

Quick start

builder.Services.AddKotoAspNetCore(); // optional: o => o.Map("payments.gateway-failed", 502)

Minimal API:

app.MapPost("/orders", (CreateOrderCommand cmd, ICqrsDispatcher dispatcher, HttpContext ctx, CancellationToken ct)
    => dispatcher.SendAsync(cmd, ct).ToHttpResultAsync(ctx));

MVC controller:

[HttpPost]
public async Task<ActionResult<OrderDto>> Create(CreateOrderCommand cmd, CancellationToken ct)
    => (await _dispatcher.SendAsync(cmd, ct)).ToActionResult(this);

Status code mapping

Resolution order: exact code → custom rules → suffix → prefix → field-error default → fallback.

Rule Status
*.not-found 404
*.already-*, *.conflict 409
*.unauthorized 401
*.forbidden 403
general.*, validation.*, Error.Field != null 400
everything else 422 (fallback, configurable)

Unmapped business errors are 422, never 500 — a failed Result is a rule violation the client can act on; 500 is reserved for unhandled exceptions.

Customize:

builder.Services.AddKotoAspNetCore(o => o
    .Map("subscription.payment-failed", StatusCodes.Status502BadGateway) // exact, highest priority
    .MapSuffix(".expired", StatusCodes.Status410Gone)
    .MapPrefix("quota.", StatusCodes.Status429TooManyRequests)
    .Map(e => e.Code.Contains(".locked-") ? StatusCodes.Status423Locked : null));
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Koto.Api.AspNetCore:

Package Downloads
Koto.Api.FastEndpoints

FastEndpoints integration for Koto: CQRS base endpoints, RFC 7807 Problem Details from Error, correlation ID middleware, and global exception handler.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0-preview.3 53 7/11/2026
0.3.0-preview.2 52 7/11/2026
0.3.0-preview.1 57 7/3/2026