@@ -26,15 +26,15 @@ To enable this library to automatically resolve and invoke validators for your m
26
26
27
27
Manually register your validator with the service container:
28
28
29
- ```
29
+ ``` cs
30
30
services .AddScoped <IValidator <User >, UserValidator >();
31
31
```
32
32
33
33
#### Automatic registration
34
34
35
35
Automatically register all validators from the assembly containing your UserValidator:
36
36
37
- ```
37
+ ``` cs
38
38
services .AddValidatorsFromAssemblyContaining <UserValidator >();
39
39
```
40
40
@@ -44,7 +44,7 @@ For more instructions on setting that up please see https://docs.fluentvalidatio
44
44
45
45
For MVC controllers reference NuGet package ` SharpGrip.FluentValidation.AutoValidation.Mvc ` (https://www.nuget.org/packages/SharpGrip.FluentValidation.AutoValidation.Mvc ).
46
46
47
- ```
47
+ ``` cs
48
48
using SharpGrip .FluentValidation .AutoValidation .Mvc .Extensions ;
49
49
50
50
builder .Services .AddFluentValidationAutoValidation ();
@@ -56,7 +56,7 @@ For minimal APIs (endpoints) reference NuGet package `SharpGrip.FluentValidation
56
56
57
57
Enabling minimal API (endpoint) automatic validation can be done on both route groups and routes.
58
58
59
- ```
59
+ ``` cs
60
60
using SharpGrip .FluentValidation .AutoValidation .Endpoints .Extensions ;
61
61
62
62
builder .Services .AddFluentValidationAutoValidation ();
@@ -83,7 +83,7 @@ app.MapPost("/", (SomeOtherModel someOtherModel) => $"Hello again {someOtherMode
83
83
| EnableCustomBindingSourceAutomaticValidation | ` false ` | Enables asynchronous automatic validation for parameters bound from ` BindingSource.Custom ` binding sources. |
84
84
| EnableNullBindingSourceAutomaticValidation | ` false ` | Enables asynchronous automatic validation for parameters not bound from any binding source (typically parameters without a declared or inferred binding source). |
85
85
86
- ```
86
+ ``` cs
87
87
using SharpGrip .FluentValidation .AutoValidation .Mvc .Extensions ;
88
88
89
89
builder .Services .AddFluentValidationAutoValidation (configuration =>
@@ -124,7 +124,7 @@ public class CustomResultFactory : IFluentValidationAutoValidationResultFactory
124
124
125
125
### Minimal APIs (endpoints)
126
126
127
- ```
127
+ ``` cs
128
128
using SharpGrip .FluentValidation .AutoValidation .Endpoints .Extensions ;
129
129
130
130
builder .Services .AddFluentValidationAutoValidation (configuration =>
@@ -189,7 +189,7 @@ In case you return `null` the default `IValidationResult` will be passed to the
189
189
190
190
### MVC controllers
191
191
192
- ```
192
+ ``` cs
193
193
// Example of a global validation interceptor.
194
194
builder .Services .AddTransient <IGlobalValidationInterceptor , CustomGlobalValidationInterceptor >();
195
195
@@ -234,7 +234,7 @@ private class TestValidator : AbstractValidator<TestModel>, IValidatorIntercepto
234
234
235
235
### Minimal APIs (endpoints)
236
236
237
- ```
237
+ ``` cs
238
238
// Example of a global validation interceptor.
239
239
builder .Services .AddTransient <IGlobalValidationInterceptor , CustomGlobalValidationInterceptor >();
240
240
0 commit comments