11# FluentValidation
2- A library for using FluentValidation with Blazor that supports async validation, severity levels and more.
2+ A library for using FluentValidation with Blazor that supports ** async validation, severity levels** and more.
3+
4+ For introduction, see this [ blog post] ( https://blog.vyvojari.dev/ghost/#/editor/post/616d98200141150b619fd93a )
5+
6+ Live demo can be found here: https://blazorrepl.telerik.com/GQYpbvbP37ENDltY58
37
48![ Build & Test Main] ( https://github.com/Liero/vNext.BlazorComponents.FluentValidation/workflows/Build%20&%20Test%20Main/badge.svg )
59
610![ Nuget] ( https://img.shields.io/nuget/v/vNext.BlazorComponents.FluentValidation.svg )
711
12+
13+
814### Installing
915
1016You can install from Nuget using the following command:
@@ -64,14 +70,14 @@ You can then use it as follows within a `EditForm` component.
6470The component locates validators using ` IValidatorFactory ` optional service.
6571The ` DefaultValidatorFactory ` implementation check for validators registered with DI first.
6672
67- If it finds multiple validators, validators withing the same assembly and namespace are takes precedence.
73+ If it finds multiple validators, validators in the same assembly and namespace are takes precedence.
6874If it can't find any, it will then try scanning the applications assemblies
6975
7076You can override default behaviour on by registering ` IValidatorFactory ` service:
7177
7278``` csharp
7379 services .AddSingleton <IValidatorFactory >(new DefaultValidatorFactory { DisableAssemblyScanning = false })
74- `
80+ ```
7581
7682or per FluentValidationValidator component
7783``` razor
@@ -94,7 +100,7 @@ class PersonValidator : AbstractValidator<Person>
94100 RuleFor (x => x .Address ).SetValidator (new AddressValidator ()); // must be set explicitelly
95101 }
96102}
97- class AddressValidator : AbstractValidator < Person > // should be separate class
103+ class AddressValidator : AbstractValidator <Address > // should be separate class
98104 {
99105 public AddressValidator () {
100106 RuleFor (x => x .Street ).NotEmpty ();
@@ -125,7 +131,7 @@ Consider following example:
125131
126132 However, ` IValidator<Address> ` will not be automatically used, unless it is explicitelly defined for Address property in ` IValidator<Person> ` .
127133
128- ###Common mistakes :
134+ ### Common mistakes:
129135
130136Address street is validated only when user edits the input, but not on submit:
131137``` csharp
0 commit comments