CoreMesh.Result.AspNetCore 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CoreMesh.Result.AspNetCore --version 0.1.1
                    
NuGet\Install-Package CoreMesh.Result.AspNetCore -Version 0.1.1
                    
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="CoreMesh.Result.AspNetCore" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreMesh.Result.AspNetCore" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="CoreMesh.Result.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 CoreMesh.Result.AspNetCore --version 0.1.1
                    
#r "nuget: CoreMesh.Result.AspNetCore, 0.1.1"
                    
#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 CoreMesh.Result.AspNetCore@0.1.1
                    
#: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=CoreMesh.Result.AspNetCore&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=CoreMesh.Result.AspNetCore&version=0.1.1
                    
Install as a Cake Tool

English | 繁體中文

CoreMesh.Result.AspNetCore

ASP.NET Core integration for CoreMesh.Result. Provides global exception handling, HTTP response conversion, and a consistent ApiResponse envelope.

Registration

builder.Services.AddCoreMeshHttp();
app.UseCoreMeshHttp();

Registers ProblemDetails and the following exception handlers (in order):

Handler Exception HTTP Status
ValidationExceptionHandler ValidationException 422
ConflictExceptionHandler ConflictException 409
ForbiddenExceptionHandler ForbiddenException 403
NotFoundExceptionHandler NotFoundException 404
GlobalExceptionHandler Any unhandled exception 400 / 401 / 500

Converting Results to HTTP Responses

// Non-generic Result → 200/204/400/404/...
result.ToHttpResult()

// Result<T> → ResultHttpResult<T> (includes OpenAPI metadata, no manual .Produces<T>() needed)
result.ToHttpResult()

// Other helpers
result.ToJson(statusCode: 201)
result.ToFile("application/pdf", "report.pdf")         // Result<byte[]>
result.ToFile("video/mp4", "video.mp4")                // Result<Stream>
result.ToServerSentEvents(eventType: "price")           // Result<IAsyncEnumerable<T>>
result.ToSignIn(principal, authenticationScheme: "...")
result.ToSignOut()

Status → HTTP Mapping

ResultStatus HTTP
Ok 200
Created 201
NoContent 204
BadRequest 400
Forbidden 403
NotFound 404
Invalid 422
Other 500

ApiResponse Envelope

// Success
{ "isSuccess": true, "code": "ok", "data": { ... } }

// Failure
{ "isSuccess": false, "code": "USER_001", "problem": { "status": 404, "detail": "..." } }

// Validation failure
{ "isSuccess": false, "code": "VALIDATION", "problem": { "status": 422, "errors": { ... } } }

NoContent, ToFile(), ToServerSentEvents(), ToSignIn(), and ToSignOut() do not use the envelope.

GlobalExceptionHandler

  • Development: returns the raw exception message
  • Production: returns a generic message for non-AppException exceptions
  • Always logs at Error level with TraceId
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
0.2.1 158 3/16/2026
0.2.0 124 3/14/2026
0.1.1 122 3/11/2026
0.1.0 122 3/11/2026