Fusonic.Extensions.AspNetCore
10.0.0
Prefix Reserved
dotnet add package Fusonic.Extensions.AspNetCore --version 10.0.0
NuGet\Install-Package Fusonic.Extensions.AspNetCore -Version 10.0.0
<PackageReference Include="Fusonic.Extensions.AspNetCore" Version="10.0.0" />
<PackageVersion Include="Fusonic.Extensions.AspNetCore" Version="10.0.0" />
<PackageReference Include="Fusonic.Extensions.AspNetCore" />
paket add Fusonic.Extensions.AspNetCore --version 10.0.0
#r "nuget: Fusonic.Extensions.AspNetCore, 10.0.0"
#:package Fusonic.Extensions.AspNetCore@10.0.0
#addin nuget:?package=Fusonic.Extensions.AspNetCore&version=10.0.0
#tool nuget:?package=Fusonic.Extensions.AspNetCore&version=10.0.0
ASP .Net Core Extensions
ServiceCollection extensions
services.AddAll<T>(IEnumerable<Assembly>) registers all implementing classes of T in the given assemblies.
CultureUtil
The culture util provides a simple way to get the culture from a user based on a list of supported cultures. It supports a "fallback-to-child", meaning if your application supports "de-AT" and the user only supports "de-DE", the util returns "de-AT" as the best common language.
Examples:
public class AppSettings
{
public CultureInfo DefaultCulture { get; set; } = null!;
public CultureInfo[] SupportedCultures { get; set; } = null!;
}
Usage:
// Supported Cultures: de-AT,en-GB
// Default: de-AT
// Header: de-AT,en-US Result: de-AT (match)
// Header: fr-FR,en-GB Result: de-AT (match)
// Header: de-DE,en-US Result: de-AT (first common language)
// Header: fr-FR,en-US Result: en-GB (first common language)
// Header: fr-FR Result: de-AT (no match, default)
CultureUtil.FromAcceptLanguageHeader(HttpContext, appSettings.SupportedCultures, appSettings.DefaultCulture)
Ignore paths Middleware
Returns 404 for all configured paths.
This is useful if you, for example, want to avoid a SPA to handle a path. A typo in an API-Url should result in 404 and should not be handled by the SPA.
Usage:
//For example right before the SPA
app.UseIgnorePaths("/api", "/swagger", "/hangfire");
Validation of Mediator requests
Mediator requests can be validated with a simple decorator. Internally it uses the same validator that is used by ASP.NET Core for the request validation.
To enable Mediator request validation, simply add the decorator RequestValidationDecorator to IRequestHandler:
// SimpleInjector
container.RegisterDecorator(typeof(IRequestHandler<,>), typeof(RequestValidationDecorator<,>));
// Scrutor
services.Decorate(typeof(IRequestHandler<,>), typeof(RequestValidationDecorator<,>));
You can then use the System.ComponentModel-attributes and the IValidatableObject-interface for validating your models. When model validation fails, a RequestValidationException gets thrown containing all the model validation errors. You might want to handle that one in your Exception filter, if you have one.
Example:
public class GetSomething : IValidatableObject
{
[Required]
public string Search { get; set; }
[Range(1, 100)]
public int MaxResults { get; set; } = 10;
public DateTime From { get; set; }
public DateTime To { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (From >= To)
yield return new ValidationResult("From must be before To.", new[] { nameof(From), nameof(To) });
}
}
This also works with records.
OpenTelemetry
Mediator tracing
To easily trace every request and notification sent by our Mediator-package, simply register the tracing decorators:
container.RegisterMediatorTracingDecorators();
container.RegisterMediator( /* Mediator configuration */ );
Also, when configuring the OpenTelemetry-Tracer, you need to enable the instrumentation:
services.AddOpenTelemetry()
.WithTracing(tracer => tracer.AddMediatorInstrumentation());
Note that the order matters. You must register the tracing decorators before mediator.
| 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
- Fusonic.Extensions.Common (>= 10.0.0)
- Fusonic.Extensions.Mediator (>= 10.0.0)
- OpenTelemetry.Api (>= 1.14.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Fusonic.Extensions.AspNetCore:
| Package | Downloads |
|---|---|
|
Fusonic.Extensions.Email
Contains common functionality for rendering email templates using razor engine and sending emails via MailKit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.0 | 405 | 11/25/2025 |
| 10.0.0-rc.2 | 167 | 11/24/2025 |
| 10.0.0-rc.1 | 136 | 9/12/2025 |
| 9.5.4 | 594 | 8/20/2025 |
| 9.5.3 | 549 | 3/28/2025 |
| 9.5.2 | 693 | 1/16/2025 |
| 9.5.0 | 348 | 10/4/2024 |
| 9.4.0 | 436 | 9/23/2024 |
| 9.3.1 | 351 | 9/11/2024 |
| 9.3.0 | 263 | 9/11/2024 |
| 9.2.0 | 276 | 8/8/2024 |
| 9.2.0-rc.3 | 106 | 8/7/2024 |
| 9.2.0-rc.2 | 89 | 8/5/2024 |
| 9.2.0-rc.1 | 97 | 8/1/2024 |
| 9.1.0 | 233 | 7/29/2024 |
| 9.0.0 | 854 | 7/17/2024 |
| 9.0.0-preview.2 | 115 | 6/13/2024 |
| 9.0.0-preview.1 | 162 | 4/5/2024 |
| 8.1.3 | 381 | 3/27/2024 |
| 8.1.2 | 273 | 3/27/2024 |