Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,27 @@ This library re-introduces this functionality for MVC controllers and introduces

## Installation

Register your validators with the Microsoft DI service container, for instructions on setting that up please see https://docs.fluentvalidation.net/en/latest/di.html.
### Validator registration

To enable this library to automatically resolve and invoke validators for your models, you must register your validators with the Dependency Injection (DI) service container.

#### Manual registration

Manually register your validator with the service container:

```
services.AddScoped<IValidator<User>, UserValidator>();
```

#### Automatic registration

Automatically register all validators from the assembly containing your UserValidator:

```
services.AddValidatorsFromAssemblyContaining<UserValidator>();
```

For more instructions on setting that up please see https://docs.fluentvalidation.net/en/latest/di.html.

### MVC controllers [![NuGet](https://img.shields.io/nuget/v/SharpGrip.FluentValidation.AutoValidation.Mvc)](https://www.nuget.org/packages/SharpGrip.FluentValidation.AutoValidation.Mvc)

Expand Down
Loading