Maple.Result.Extensions.Functions.Worker.AspNetCore 0.15.0

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

Maple.Result.Extensions.Functions.Worker.AspNetCore

Maps the Maple.Result to the HTTP response in Azure Functions (isolated worker model) with ASP.NET Core integration.

The functions using HttpRequestData and HttpResponseData, without ASP.NET Core integration, should use Maple.Result.Extensions.Functions.Worker.

Project status: EARLY STAGE

Usage

using Maple.Result;
using Maple.Result.Extensions.Functions.Worker.AspNetCore;

// Success -> 204 No Content, error -> RFC 9457 problem details
[Function("DeleteOrder")]
public IActionResult DeleteOrder(
    [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "orders/{id:int}")] HttpRequest request, int id)
    => _orderService.Delete(id).ToActionResult();

// Success -> 200 OK with the value (204 No Content when the value is null)
[Function("GetOrder")]
public IActionResult GetOrder(
    [HttpTrigger(AuthorizationLevel.Function, "get", Route = "orders/{id:int}")] HttpRequest request, int id)
    => _orderService.Get(id).ToActionResult();

// Success -> the given status code
[Function("CreateOrder")]
public IActionResult CreateOrder(
    [HttpTrigger(AuthorizationLevel.Function, "post", Route = "orders")] HttpRequest request)
    => _orderService.Create().ToActionResult(HttpStatusCode.Created);

// Success -> mapped explicitly, here to 201 Created with the Location header
[Function("CopyOrder")]
public IActionResult CopyOrder(
    [HttpTrigger(AuthorizationLevel.Function, "post", Route = "orders/{id:int}/copy")] HttpRequest request, int id)
    => _orderService.Copy(id).ToActionResult(order => new CreatedResult($"/orders/{order.Id}", order));

// Errors -> mapped explicitly; the default mapping is used when the mapping returns null
[Function("DeleteOrderLines")]
public IActionResult DeleteOrderLines(
    [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "orders/{id:int}/lines")] HttpRequest request, int id)
    => _orderService.DeleteLines(id).ToActionResult(
        customErrorMapping: error => error.Category == ErrorCategory.Conflict
            ? new StatusCodeResult(StatusCodes.Status410Gone)
            : null);

Error responses

Errors are returned as RFC 9457 problem details, in the same format as in Maple.Result.Extensions.AspNetCore. They include the traceId extension, and the CustomizeProblemDetails option of AddProblemDetails is applied to them. This option runs before the errors and detailTemplated extensions are added, so it cannot read, change or remove them. To control them, use customErrorMapping.

Good to know

  • There are no global mappings. To use the same mapping in many functions, pass a shared static method.
  • The mapping functions do not receive any context. If they need the request or the response, they can capture the HttpRequest parameter of the function.
  • A mapping passed without a parameter name always maps the successful result, so an error mapping has to be passed as customErrorMapping: unless a success mapping precedes it.

Contribution

Please contact author: engineer(at sign)blumail(dot)me

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.15.0 112 11/5/2026