Fluens.Web
0.5.5
dotnet add package Fluens.Web --version 0.5.5
NuGet\Install-Package Fluens.Web -Version 0.5.5
<PackageReference Include="Fluens.Web" Version="0.5.5" />
<PackageVersion Include="Fluens.Web" Version="0.5.5" />
<PackageReference Include="Fluens.Web" />
paket add Fluens.Web --version 0.5.5
#r "nuget: Fluens.Web, 0.5.5"
#:package Fluens.Web@0.5.5
#addin nuget:?package=Fluens.Web&version=0.5.5
#tool nuget:?package=Fluens.Web&version=0.5.5
Fluens.Web
ASP.NET Core base types for Fluens web libraries: Result-to-HTTP mapping, global exception handler, and paged responses.
Installation
dotnet add package Fluens.Web
Usage
fluensBuilder.AddWeb();
// In middleware pipeline
app.UseExceptionHandler(); // GlobalExceptionHandler returns ProblemDetails
ResultExtensions map Result / Result<T> to HTTP responses:
app.MapPost("/orders", async (CreateOrder cmd, ICommandDispatcher dispatcher, CancellationToken ct) =>
{
var result = await dispatcher.SendAsync(cmd, ct);
return result.ToHttpResult(); // 204 on success, 4xx/5xx on failure
});
Error mapping: NotFoundError → 404, ValidationError → 400, ConflictError → 409, ForbiddenError → 403, unknown Error → 500.
Server-Side Localization
Pass an optional IStringLocalizer to translate error messages server-side. The Error.Message is used as the localization key and {Key} placeholders are replaced with MessageArgs values:
app.MapPost("/orders", async (
CreateOrder cmd,
ICommandDispatcher dispatcher,
IStringLocalizer<OrderErrors> localizer,
CancellationToken ct) =>
{
var result = await dispatcher.SendAsync(cmd, ct);
return result.ToHttpResult(localizer); // Translates error messages using localizer
});
When no localizer is provided (default), Error.Message is returned as-is — maintaining full backward compatibility. MessageArgs is always included in ProblemDetails.Extensions["messageArgs"] regardless of whether a localizer is used.
TranslatableMessageExtensions
Translate TranslatableMessage instances (from Fluens.Kernel.Translations) using ASP.NET Core IStringLocalizer:
var message = new TranslatableMessage("order.status.changed")
.WithArg("orderId", "ORD-123")
.WithArg("newStatus", "Shipped");
// Translate using IStringLocalizer — Code is the localization key,
// {Key} placeholders are replaced with Args values
string translated = message.Translate(localizer);
License
This project is licensed under the MIT License.
| 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
- Fluens (>= 0.5.5)
- Fluens.Extensions (>= 0.5.5)
- Fluens.Kernel (>= 0.5.5)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Fluens.Web:
| Package | Downloads |
|---|---|
|
Fluens.Web.Auth
JWT Bearer authentication and security headers middleware for Fluens web applications. |
|
|
Fluens.Web.Observability
ASP.NET Core observability features: Prometheus metrics endpoint and request logging middleware. |
|
|
Fluens.Web.Contexts
CorrelationId propagation, context accessors, and consumed message context for ASP.NET Core applications. |
|
|
Fluens.Web.Validation
FluentValidation integration for ASP.NET Core minimal API endpoints with automatic request validation. |
|
|
Fluens.Web.Cors
CORS configuration and middleware setup for Fluens web applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.