Class IServiceCollectionExtensions
The extensions in this class are brought in from the FluentValidation source: https://github.com/JeremySkinner/FluentValidation They are copyright the original author as per this (Apache 2.0) license: https://github.com/JeremySkinner/FluentValidation/blob/5d86531ba7dcfade6055c00a5dc45ed32660148d/License.txt FluentValidation only includes them as part of its broader ASP.Net Core package that we don't want to reference here
Inheritance
Namespace: FunctionMonkey.FluentValidation
Assembly: FunctionMonkey.FluentValidation.dll
Syntax
public static class IServiceCollectionExtensions : object
Methods
| Improve this Doc View SourceAddValidatorsFromAssemblies(IServiceCollection, IEnumerable<Assembly>, ServiceLifetime)
Adds all validators in specified assemblies
Declaration
public static IServiceCollection AddValidatorsFromAssemblies(this IServiceCollection services, IEnumerable<Assembly> assemblies, ServiceLifetime lifetime = null)
Parameters
Type | Name | Description |
---|---|---|
IService |
services | The collection of services |
IEnumerable<Assembly> | assemblies | |
Service |
lifetime | The lifetime of the validators. The default is transient |
Returns
Type | Description |
---|---|
IService |
AddValidatorsFromAssembly(IServiceCollection, Assembly, ServiceLifetime)
Adds all validators in specified assembly
Declaration
public static IServiceCollection AddValidatorsFromAssembly(this IServiceCollection services, Assembly assembly, ServiceLifetime lifetime = null)
Parameters
Type | Name | Description |
---|---|---|
IService |
services | The collection of services |
Assembly | assembly | The assembly to scan |
Service |
lifetime | The lifetime of the validators. The default is transient |
Returns
Type | Description |
---|---|
IService |
AddValidatorsFromAssemblyContaining(IServiceCollection, Type, ServiceLifetime)
Adds all validators in the assembly of the specified type
Declaration
public static IServiceCollection AddValidatorsFromAssemblyContaining(this IServiceCollection services, Type type, ServiceLifetime lifetime = null)
Parameters
Type | Name | Description |
---|---|---|
IService |
services | The collection of services |
Type | type | The type whose assembly to scan |
Service |
lifetime | The lifetime of the validators. The default is transient |
Returns
Type | Description |
---|---|
IService |
AddValidatorsFromAssemblyContaining<T>(IServiceCollection, ServiceLifetime)
Adds all validators in the assembly of the type specified by the generic parameter
Declaration
public static IServiceCollection AddValidatorsFromAssemblyContaining<T>(this IServiceCollection services, ServiceLifetime lifetime = null)
Parameters
Type | Name | Description |
---|---|---|
IService |
services | The collection of services |
Service |
lifetime | The lifetime of the validators. The default is transient |
Returns
Type | Description |
---|---|
IService |
Type Parameters
Name | Description |
---|---|
T |