Add an extension to IServiceCollection to add all Validators in Assembly without MVC
See original GitHub issueI’ve been looking around everywhere but can’t seem to find the Extension method on IServiceCollection
. With the coming of Razor Components we don’t have controllers anymore but pages. Therefore it would be nice to have an Extension method AddValidators
which looks up all the IValidators and hooks them into DI e.g.:
services.AddTransient<IValidator<CreateCustomerCommand>, CreateCustomerValidator>();
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Add an extension to IServiceCollection to add all Validators ...
I've been looking around everywhere but can't seem to find the Extension method on IServiceCollection. With the coming of Razor Components ...
Read more >Adding Mvc options separately after adding Mvc services
I would like to write an extension method for for the IServiceCollection , which will do the configuration in the application. The reason...
Read more >MvcCoreServiceCollectionExten...
Adds the minimum essential MVC services to the specified IServiceCollection. ... MVC's support for authorization, formatters, and validation must be added ...
Read more >ASP.NET Core — FluentValidation documentation
Alternatively you can register all validators in a specific assembly by using our Service Collection extensions. To do this you'll need to install...
Read more >Dependency injection in ASP.NET Core
The convention is to use a single Add{GROUP_NAME} extension method to register all of the services required by a framework feature.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Where will the
FluentValidation.DependencyInjection
package be located?Hi, although there’s no extension method you can use FluentValidation’s AssemblyScanner for this already:
(This is what the MVC extension uses internally)