Trellis.Asp 3.0.0-alpha.449

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

Trellis.Asp

NuGet Package

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() (or AddTrellisAsp() + AddScalarValueValidation()) additionally configures global MvcOptions / JsonOptions for 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> and Error values 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 instance populated from the request path so clients can correlate failures with the originating request.
  • Ship the canonical ProblemDetails recipe via AddTrellisProblemDetails() + UseTrellisProblemDetails() (trace id from Activity.Current, friendly 500 detail, allow array on 405). Composes with any consumer CustomizeProblemDetails callback so the application keeps the last word on collisions.
  • Make POST / PATCH retry-safe with the opt-in IETF Idempotency-Key middleware (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 unkeyed IActorProvider so HTTP requests still resolve through it and background-worker scopes (no HttpContext) resolve to the supplied system actor.
  • Handle nested-JSON identity-provider claims (Auth0 app_metadata.roles, Azure B2C extension_*, some Okta token shapes) via services.AddNestedJsonPathClaimsActorProvider(...). Configure a ContainerClaim plus dotted ActorIdPath / PermissionsPath; falls back through the inherited flat-claim resolver when the path misses or the container is malformed. The base ClaimsActorProvider also gains once-per-app-lifetime diagnostics that surface the silent-403 footgun when the configured PermissionsClaim resolves 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() decodes X-MS-CLIENT-PRINCIPAL (with -ID / -NAME fallback) onto HttpContext.User, then services.AddEasyAuthActorProvider(...) maps its claims and varies the response cache by the platform principal headers instead of Authorization. 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 (the TrellisInternalJwtActorProvider + AddTrellisInternalJwtActorProvider extension that previously lived under Trellis.Asp.Authorization moved to that repo, along with Trellis.Yarp).

Documentation

Part of Trellis

This package is part of the Trellis framework.

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 (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
Loading failed