Koto.Api.AspNetCore
0.3.0-preview.3
dotnet add package Koto.Api.AspNetCore --version 0.3.0-preview.3
NuGet\Install-Package Koto.Api.AspNetCore -Version 0.3.0-preview.3
<PackageReference Include="Koto.Api.AspNetCore" Version="0.3.0-preview.3" />
<PackageVersion Include="Koto.Api.AspNetCore" Version="0.3.0-preview.3" />
<PackageReference Include="Koto.Api.AspNetCore" />
paket add Koto.Api.AspNetCore --version 0.3.0-preview.3
#r "nuget: Koto.Api.AspNetCore, 0.3.0-preview.3"
#:package Koto.Api.AspNetCore@0.3.0-preview.3
#addin nuget:?package=Koto.Api.AspNetCore&version=0.3.0-preview.3&prerelease
#tool nuget:?package=Koto.Api.AspNetCore&version=0.3.0-preview.3&prerelease
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 manyErrors (multiple errors become validation problem details with anerrorsdictionary per field)KotoHttpErrorOptions— extensibleError.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 | 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
- Koto.Domain (>= 0.3.0-preview.3)
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 |