@@ -26,15 +26,15 @@ To enable this library to automatically resolve and invoke validators for your m
2626
2727Manually register your validator with the service container:
2828
29- ```
29+ ``` cs
3030services .AddScoped <IValidator <User >, UserValidator >();
3131```
3232
3333#### Automatic registration
3434
3535Automatically register all validators from the assembly containing your UserValidator:
3636
37- ```
37+ ``` cs
3838services .AddValidatorsFromAssemblyContaining <UserValidator >();
3939```
4040
@@ -44,7 +44,7 @@ For more instructions on setting that up please see https://docs.fluentvalidatio
4444
4545For MVC controllers reference NuGet package ` SharpGrip.FluentValidation.AutoValidation.Mvc ` (https://www.nuget.org/packages/SharpGrip.FluentValidation.AutoValidation.Mvc ).
4646
47- ```
47+ ``` cs
4848using SharpGrip .FluentValidation .AutoValidation .Mvc .Extensions ;
4949
5050builder .Services .AddFluentValidationAutoValidation ();
@@ -56,7 +56,7 @@ For minimal APIs (endpoints) reference NuGet package `SharpGrip.FluentValidation
5656
5757Enabling minimal API (endpoint) automatic validation can be done on both route groups and routes.
5858
59- ```
59+ ``` cs
6060using SharpGrip .FluentValidation .AutoValidation .Endpoints .Extensions ;
6161
6262builder .Services .AddFluentValidationAutoValidation ();
@@ -83,7 +83,7 @@ app.MapPost("/", (SomeOtherModel someOtherModel) => $"Hello again {someOtherMode
8383| EnableCustomBindingSourceAutomaticValidation | ` false ` | Enables asynchronous automatic validation for parameters bound from ` BindingSource.Custom ` binding sources. |
8484| EnableNullBindingSourceAutomaticValidation | ` false ` | Enables asynchronous automatic validation for parameters not bound from any binding source (typically parameters without a declared or inferred binding source). |
8585
86- ```
86+ ``` cs
8787using SharpGrip .FluentValidation .AutoValidation .Mvc .Extensions ;
8888
8989builder .Services .AddFluentValidationAutoValidation (configuration =>
@@ -124,7 +124,7 @@ public class CustomResultFactory : IFluentValidationAutoValidationResultFactory
124124
125125### Minimal APIs (endpoints)
126126
127- ```
127+ ``` cs
128128using SharpGrip .FluentValidation .AutoValidation .Endpoints .Extensions ;
129129
130130builder .Services .AddFluentValidationAutoValidation (configuration =>
@@ -189,7 +189,7 @@ In case you return `null` the default `IValidationResult` will be passed to the
189189
190190### MVC controllers
191191
192- ```
192+ ``` cs
193193// Example of a global validation interceptor.
194194builder .Services .AddTransient <IGlobalValidationInterceptor , CustomGlobalValidationInterceptor >();
195195
@@ -234,7 +234,7 @@ private class TestValidator : AbstractValidator<TestModel>, IValidatorIntercepto
234234
235235### Minimal APIs (endpoints)
236236
237- ```
237+ ``` cs
238238// Example of a global validation interceptor.
239239builder .Services .AddTransient <IGlobalValidationInterceptor , CustomGlobalValidationInterceptor >();
240240
0 commit comments