Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually perform FluentValidation using Middleware #154

Open
Zhiyuan-Amos opened this issue Jul 4, 2022 · 0 comments
Open

Manually perform FluentValidation using Middleware #154

Zhiyuan-Amos opened this issue Jul 4, 2022 · 0 comments

Comments

@Zhiyuan-Amos
Copy link
Owner

Zhiyuan-Amos commented Jul 4, 2022

FluentValidation #1959 states that FluentValidation.AspNetCore and the auto-validation feature will be deprecated, unless the community supports and owns the repository.

Another alternative is to use Middleware / Action Filter, and I'm hoping a kind soul creates a solution for that.

In the meantime, let's stick with the auto-validation feature.

Changes required:

  1. Replace .AddFluentValidation(fv => fv.RegisterValidatorsFromAssembly(Assembly.GetExecutingAssembly())) with .AddValidatorsFromAssembly(Assembly.GetExecutingAssembly())
  2. Replace NuGet package FluentValidation.AspNetCore with FluentValidation
  3. Add pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant