Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters
1.0.2
dotnet add package Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters --version 1.0.2
NuGet\Install-Package Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters -Version 1.0.2
<PackageReference Include="Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters" Version="1.0.2" />
<PackageVersion Include="Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters" Version="1.0.2" />
<PackageReference Include="Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters" />
paket add Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters --version 1.0.2
#r "nuget: Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters, 1.0.2"
#:package Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters@1.0.2
#addin nuget:?package=Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters&version=1.0.2
#tool nuget:?package=Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters&version=1.0.2
ASP.NET Core Action Filters
A collection of reusable action filters that I have implemented and used in several ASP.NET Core applications, providing common functionality for some of or all the action methods in each application.
1. ValidateRequestParameters
Validates the parameters of an action method using the IValidator<T>
implementation registered in the dependency injection container.
Usage
Install package from NuGet via the .NET CLI, Package Manager Console or any other preferred method:
- .NET CLI
dotnet add package Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters
- Package Manager Console
Install-Package Olumuyiwa.DotNetDevKit.AspNetCore.ActionFilters
Register the
IValidator<T>
implementation in the dependency inject container in theConfigureServices
method of yourStartup.cs
file or directly in yourProgram.cs
file:
services.AddScoped<IValidator<CreateUserRequest>, CreateUserRequestValidator>();
- Apply the
ValidateRequestParameters
attribute to your action method:
[HttpPost]
[ValidateRequestParameters]
public async Task<IActionResult> CreateUser(CreateUserRequest request)
{
// Your action method implementation
}
or to your entire controller:
[ApiController]
[ValidateRequestParameters]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
// Your controller implementation
}
or to all your controllers:
services.AddControllers(options =>
{
options.Filters.Add<ValidateRequestParametersAttribute>();
});
2. Coming soon...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- FluentValidation (>= 12.0.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.