Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

TechNobre/PowerUtils.AspNetCore.ErrorHandler.Validations

Repository files navigation

PowerUtils.AspNetCore.ErrorHandler.Validations

⚠️ DEPRECATED

This package has been discontinued because it never evolved, and the code present in this package does not justify its continuation. It is preferable to implement this code directly in the project if necessary.

Logo

Add middleware in AspNetCore pipeline to standardize validation responses

License: MIT

Support to

  • .NET 7.0
  • .NET 6.0
  • .NET 5.0

Dependencies

  • Microsoft.AspNetCore.Mvc NuGet
  • PowerUtils.AspNetCore.ErrorHandler NuGet
  • PowerUtils.Validations NuGet

How to use

Install NuGet package

This package is available through Nuget Packages: https://www.nuget.org/packages/PowerUtils.AspNetCore.ErrorHandler.Validations

Nuget

Install-Package PowerUtils.AspNetCore.ErrorHandler.Validations

.NET CLI

dotnet add package PowerUtils.AspNetCore.ErrorHandler.Validations

Validation notifications middleware

You need to add services.AddErrorHandler(); for services.AddValidationNotifications(); to work

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddValidationNotifications();
        services.AddErrorHandler();
        ...
    }

    public void Configure(IApplicationBuilder app)
    {
        app.UseErrorHandler();
        ...
    }
}

Contribution

If you have any questions, comments, or suggestions, please open an issue or create a pull request