JV.ResultUtilities.AspNetCore 11.0.0

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

JV.ResultUtilities.AspNetCore

The ASP.NET Core bridge for JV.ResultUtilities: one exception handler that turns a thrown ResultException into an RFC 9457 problem body, with the HTTP status coming from the failing key, structured errors / validation extensions for clients, and request validation through AbstractValidator<T>.

// Program.cs
builder.Services.AddControllers();
builder.Services.AddResultProblemDetails<ResxResultMessageTranslator>(options =>
{
    options.MapStatus(ValidationKeys.Legacy.Locked, 423);   // for keys you do not own
});
builder.Services.AddResultValidation(typeof(Program).Assembly);

var app = builder.Build();
app.UseExceptionHandler();
app.MapControllers();
// Domain: the key says what it is over HTTP
public static readonly ValidationKeyDefinition NotFound =
    ValidationKeyDefinition.Create("User.NotFound").WithGuidParameter("id")
        .WithHttpStatusCode(HttpStatusCode.NotFound);   // core helper; WithHttpStatus(404) is the int form

// Controller: no HasError ladder
var (result, user) = await service.GetAsync(id, ct);
result.ThrowIfFailure();            // → 404 application/problem+json
return Ok(UserResponse.Map(user));

The body:

{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.5",
  "title": "Not Found",
  "status": 404,
  "detail": "User 3f2c… was not found.",
  "instance": "GET /api/users/3f2c…",
  "traceId": "…", "requestId": "…",
  "errors":     { "": ["User 3f2c… was not found."] },
  "validation": [{ "key": "User.NotFound", "field": null, "message": "…", "parameters": { "id": "3f2c…" } }]
}
  • errors uses ASP.NET Core's own ValidationProblemDetails shape (field → messages), so a client's existing model-binding error path handles domain failures too.
  • validation is lossless: stable key to branch on, field, translated message, named raw parameters.
  • The handler answers only ResultException. Anything else returns false and the framework's default handling logs it and writes a 500 with no exception message — so this package never leaks one.
  • Status per message: WithHttpStatusCode (or the int WithHttpStatus) on the key, else options.MapStatus, else DefaultStatusCode (400). Several messages: all equal → that status; otherwise any 5xx → the highest, else the default.
  • Validation failures are logged at Information (configurable). They are client errors.

IResultMessageTranslator is the one seam you implement: string Translate(ValidationMessage). The fallback returns the key. ValidateModelFilter runs every registered IValidator against matching action arguments before the action and throws the same ResultException, so request-shape and business-rule failures share one wire shape.

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

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
11.0.0 93 9/20/2026