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
<PackageReference Include="Maple.Result.Extensions.Functions.Worker.AspNetCore" Version="0.15.0" />
<PackageVersion Include="Maple.Result.Extensions.Functions.Worker.AspNetCore" Version="0.15.0" />
<PackageReference Include="Maple.Result.Extensions.Functions.Worker.AspNetCore" />
paket add Maple.Result.Extensions.Functions.Worker.AspNetCore --version 0.15.0
#r "nuget: Maple.Result.Extensions.Functions.Worker.AspNetCore, 0.15.0"
#:package Maple.Result.Extensions.Functions.Worker.AspNetCore@0.15.0
#addin nuget:?package=Maple.Result.Extensions.Functions.Worker.AspNetCore&version=0.15.0
#tool nuget:?package=Maple.Result.Extensions.Functions.Worker.AspNetCore&version=0.15.0
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
HttpRequestparameter 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 | 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
- Maple.Result (>= 2.8.0)
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 |