Trellis.Asp
3.0.0-alpha.449
dotnet add package Trellis.Asp --version 3.0.0-alpha.449
NuGet\Install-Package Trellis.Asp -Version 3.0.0-alpha.449
<PackageReference Include="Trellis.Asp" Version="3.0.0-alpha.449" />
<PackageVersion Include="Trellis.Asp" Version="3.0.0-alpha.449" />
<PackageReference Include="Trellis.Asp" />
paket add Trellis.Asp --version 3.0.0-alpha.449
#r "nuget: Trellis.Asp, 3.0.0-alpha.449"
#:package Trellis.Asp@3.0.0-alpha.449
#addin nuget:?package=Trellis.Asp&version=3.0.0-alpha.449&prerelease
#tool nuget:?package=Trellis.Asp&version=3.0.0-alpha.449&prerelease
Trellis.Asp
ASP.NET Core integration for Trellis results, scalar value validation, and clean HTTP responses.
Installation
dotnet add package Trellis.Asp
Quick Example
using Trellis;
using Trellis.Asp;
// Greenfield default — error mapping + scalar-value JSON / model-binding validation:
builder.Services.AddTrellisAspWithScalarValidation();
app.MapGet("/widgets/{id}", (string id) =>
Result.Ok(id).ToHttpResponse());
AddTrellisAsp()registers error-to-status mapping only.AddTrellisAspWithScalarValidation()(orAddTrellisAsp()+AddScalarValueValidation()) additionally configures globalMvcOptions/JsonOptionsfor value-object binding and JSON serialization. The split exists so the global-options mutation is opt-in instead of silent.
Key Features
- Convert
Result<T>andErrorvalues into consistent HTTP responses. - Validate Trellis scalar values during model binding and JSON deserialization.
- Support controller and minimal API styles, including AOT-friendly setups.
- Emit RFC 9457 Problem Details with
instancepopulated from the request path so clients can correlate failures with the originating request. - Ship the canonical ProblemDetails recipe via
AddTrellisProblemDetails()+UseTrellisProblemDetails()(trace id fromActivity.Current, friendly 500 detail,allowarray on 405). Composes with any consumerCustomizeProblemDetailscallback so the application keeps the last word on collisions. - Make
POST/PATCHretry-safe with the opt-in IETFIdempotency-Keymiddleware (AddTrellisIdempotency(...)+AddInMemoryIdempotencyStore()+UseTrellisIdempotency()). Mark endpoints with[Idempotent]; the middleware buffers the request body, fingerprints(method, path, headers, body), scopes by actor (default), and replays captured responses verbatim on retries. - Compose a worker/system actor outside HTTP via
services.AddTrellisWorkerActor(systemActor). Wraps the existing unkeyedIActorProviderso HTTP requests still resolve through it and background-worker scopes (noHttpContext) resolve to the supplied system actor. - Handle nested-JSON identity-provider claims (Auth0
app_metadata.roles, Azure B2Cextension_*, some Okta token shapes) viaservices.AddNestedJsonPathClaimsActorProvider(...). Configure aContainerClaimplus dottedActorIdPath/PermissionsPath; falls back through the inherited flat-claim resolver when the path misses or the container is malformed. The baseClaimsActorProvideralso gains once-per-app-lifetime diagnostics that surface the silent-403 footgun when the configuredPermissionsClaimresolves to zero entries on an authenticated identity or to a JSON-shaped scalar value. - Map Azure App Service / Container Apps built-in authentication ("Easy Auth") principal headers to an
Actor:AddAuthentication(...).AddEasyAuth()decodesX-MS-CLIENT-PRINCIPAL(with-ID/-NAMEfallback) ontoHttpContext.User, thenservices.AddEasyAuthActorProvider(...)maps its claims and varies the response cache by the platform principal headers instead ofAuthorization. Trust precondition: enable only when the app is reachable exclusively through the Easy Auth front end. - For microservices that consume gateway-minted internal JWTs, use the separately-packaged
Trellis.Microservices.AspNetCore(theTrellisInternalJwtActorProvider+AddTrellisInternalJwtActorProviderextension that previously lived underTrellis.Asp.Authorizationmoved to that repo, along withTrellis.Yarp).
Documentation
Part of Trellis
This package is part of the Trellis framework.
| 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
- Microsoft.Extensions.DependencyModel (>= 10.0.10)
- OpenTelemetry.Api (>= 1.17.0)
- Trellis.Authorization (>= 3.0.0-alpha.449)
- Trellis.Core (>= 3.0.0-alpha.449)
- Trellis.Http.Abstractions (>= 3.0.0-alpha.449)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Trellis.Asp:
| Package | Downloads |
|---|---|
|
Trellis.Asp.ApiVersioning
API-versioning helpers for Trellis.Asp. Adds a WithVersionedRoute() extension on HttpResponseOptionsBuilder that auto-injects the api-version route value into Location headers, so responses round-trip the requested version under query/header API versioning. Chain after CreatedAtRoute(...), CreatedAtAction(...), or WithLocation(...). Skips injection for [ApiVersionNeutral] endpoints, URL-segment-versioned routes, and endpoints with no ApiVersionMetadata (composes cleanly in unversioned and mixed-versioned hosts). |
|
|
Trellis.ServiceDefaults
Opinionated service composition defaults for Trellis web services. Provides a tiered builder that wires ASP integration, Mediator behaviors, FluentValidation, resource authorization, actor providers, and EF Core Unit of Work in canonical order. |
|
|
Trellis.Microservices.AspNetCore
Consumer-side counterpart to Trellis.Yarp. Hydrates the full Trellis Actor (id + permissions + forbidden permissions + ABAC attributes) from a verified gateway-minted internal JWT, enforcing the strict sentinel + count claim contract that defends the deny-overrides-allow invariant against a proxy stripping the deny set. AOT-compatible. |
|
|
Trellis.Asp.Idempotency.Cosmos
Cosmos DB-backed IIdempotencyStore for Trellis.Asp. Safe across instances and process restarts: reservations are claimed with an atomic CreateItem (409 on duplicate id) and every subsequent mutation is an ETag-conditional replace or delete, so Session consistency cannot cause a double execution. Enforces TTL and reservation-timeout expiry in-process rather than trusting Cosmos DB's best-effort background sweep. Verified by the Trellis.Testing.Idempotency conformance suite. |
|
|
Trellis.Testing.Idempotency
Executable conformance suite for Trellis IIdempotencyStore implementations - inherit one class to prove a Redis, Cosmos DB, EF Core, or bespoke store satisfies the reserve, replay, takeover, and abandon contract |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-alpha.449 | 7 | 8/18/2026 |
| 3.0.0-alpha.447 | 41 | 8/18/2026 |
| 3.0.0-alpha.432 | 141 | 7/6/2026 |
| 3.0.0-alpha.428 | 125 | 7/3/2026 |
| 3.0.0-alpha.425 | 173 | 6/27/2026 |
| 3.0.0-alpha.419 | 83 | 6/24/2026 |
| 3.0.0-alpha.418 | 247 | 6/23/2026 |
| 3.0.0-alpha.417 | 75 | 6/23/2026 |
| 3.0.0-alpha.397 | 165 | 6/18/2026 |
| 3.0.0-alpha.396 | 75 | 6/18/2026 |
| 3.0.0-alpha.394 | 110 | 6/18/2026 |
| 3.0.0-alpha.385 | 79 | 6/15/2026 |
| 3.0.0-alpha.382 | 80 | 6/12/2026 |
| 3.0.0-alpha.372 | 82 | 6/10/2026 |
| 3.0.0-alpha.360 | 115 | 6/7/2026 |
| 3.0.0-alpha.342 | 122 | 6/5/2026 |
| 3.0.0-alpha.337 | 84 | 6/3/2026 |
| 3.0.0-alpha.336 | 75 | 6/3/2026 |
| 3.0.0-alpha.304 | 84 | 5/29/2026 |
| 3.0.0-alpha.303 | 69 | 5/29/2026 |