Fluens.Web
0.7.2
See the version list below for details.
dotnet add package Fluens.Web --version 0.7.2
NuGet\Install-Package Fluens.Web -Version 0.7.2
<PackageReference Include="Fluens.Web" Version="0.7.2" />
<PackageVersion Include="Fluens.Web" Version="0.7.2" />
<PackageReference Include="Fluens.Web" />
paket add Fluens.Web --version 0.7.2
#r "nuget: Fluens.Web, 0.7.2"
#:package Fluens.Web@0.7.2
#addin nuget:?package=Fluens.Web&version=0.7.2
#tool nuget:?package=Fluens.Web&version=0.7.2
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.
IServiceCatalog
IServiceCatalog is the central, synchronous service-resolution contract consumed by web libraries (HTTP, messaging) without depending on the underlying discovery implementation. It lives in the base project — like IHealthEndpointInfo — so consumers stay decoupled from the Consul-backed implementation in Fluens.Web.Discovery.
public interface IServiceCatalog
{
// One healthy endpoint for the service, or null when none is available.
ResolvedServiceEndpoint? Resolve(string serviceName);
// Services advertising the tag, optionally filtered by metadata key/value pairs.
IReadOnlyList<DiscoveredService> List(string tag, IReadOnlyDictionary<string, string>? metaMatch = null);
// Fires when the catalog snapshot changes (topology updates).
IChangeToken GetChangeToken();
}
The return types are immutable records:
var endpoint = catalog.Resolve("orders-api");
Uri uri = endpoint?.ToUri(); // scheme://host:port/
foreach (var service in catalog.List("fluens-mesh", new Dictionary<string, string> { ["fluens-cluster"] = "c1" }))
{
ResolvedServiceEndpoint? first = service.FirstHealthyEndpoint; // null when no endpoints
}
ResolvedServiceEndpoint(string Scheme, string Host, int Port)—ToUri()composes an absolutescheme://host:port/URI.DiscoveredService(string ServiceName, IReadOnlyList<ResolvedServiceEndpoint> Endpoints, IReadOnlyList<string> Tags, IReadOnlyDictionary<string, string> Meta)—FirstHealthyEndpointreturns the first endpoint ornullwhenEndpointsis empty.
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.7.2)
- Fluens.Extensions (>= 0.7.2)
- Fluens.Kernel (>= 0.7.2)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Fluens.Web:
| Package | Downloads |
|---|---|
|
Fluens.Web.Contexts
CorrelationId propagation, context accessors, and consumed message context for ASP.NET Core applications. |
|
|
Fluens.Web.Auth
JWT Bearer authentication and security headers middleware for Fluens web applications. |
|
|
Fluens.Web.Api
Endpoint discovery, OpenAPI documentation with Scalar UI, and fixed-window rate limiting for ASP.NET Core minimal APIs. |
|
|
Fluens.Web.Cors
CORS configuration and middleware setup for Fluens web applications. |
|
|
Fluens.Web.Validation
FluentValidation integration for ASP.NET Core minimal API endpoints with automatic request validation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.5 | 5 | 6/22/2026 |
| 0.7.4 | 91 | 6/18/2026 |
| 0.7.2 | 93 | 6/18/2026 |
| 0.7.1 | 102 | 6/18/2026 |
| 0.6.6 | 317 | 3/11/2026 |
| 0.6.5 | 154 | 3/4/2026 |
| 0.6.4 | 145 | 3/4/2026 |
| 0.6.3 | 165 | 3/3/2026 |
| 0.6.2 | 165 | 3/2/2026 |
| 0.6.1 | 163 | 3/2/2026 |
| 0.6.0 | 157 | 3/1/2026 |
| 0.5.7 | 161 | 3/1/2026 |
| 0.5.6 | 153 | 3/1/2026 |
| 0.5.5 | 158 | 2/28/2026 |
| 0.5.4 | 153 | 2/28/2026 |
| 0.5.3 | 164 | 2/27/2026 |
| 0.5.2 | 155 | 2/27/2026 |
| 0.5.1 | 161 | 2/27/2026 |
| 0.5.0 | 163 | 2/26/2026 |
| 0.3.2 | 166 | 2/26/2026 |