Class MessageProviderRegistrationBuilder
A helper/builder service which coordinates both the registration of message provider types with the service collection, and also registers them with an options type so that they may be found by MessageProviderRegistry.
Inheritance
Implements
Inherited Members
Namespace: CSF.Validation.Bootstrap
Assembly: CSF.Validation.dll
Syntax
public class MessageProviderRegistrationBuilder : IRegistersMessageProviders
Properties
| Improve this Doc View SourceMessageProviderTypes
Gets a collection of the message provider types which have been found and registered with the current builder.
Declaration
public IReadOnlyCollection<Type> MessageProviderTypes { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<System.Type> |
Methods
| Improve this Doc View SourceAddMessageProvider(Type)
Adds a single validation message provider type to the the service collection, so that it may be dependency-injected.
Declaration
public IRegistersMessageProviders AddMessageProvider(Type providerType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | providerType | The type of validation message provider to add to DI. |
Returns
| Type | Description |
|---|---|
| IRegistersMessageProviders | The registration helper, so that calls may be chained. |
Remarks
Use this method only when you wish to add individual message providers to dependency injection. It is usually more convenient to use one of the following methods to add message providers in bulk, using assembly-scanning techniques.
- AddMessageProvidersInAssembly(Assembly)
- AddMessageProvidersInAssemblies(Assembly[])
- AddMessageProvidersInAssemblies(IEnumerable<Assembly>)
This method also registers the message provider type so that it may be used with an IGetsCandidateMessageTypes.
AddMessageProvidersInAssemblies(IEnumerable<Assembly>)
Scans the specified assemblies for validation message providers and registers every one of
them, so that they may be dependency-injected.
Declaration
public IRegistersMessageProviders AddMessageProvidersInAssemblies(IEnumerable<Assembly> assemblies)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.Reflection.Assembly> | assemblies | A collection of assemblies to scan for validation message provider classes. |
Returns
| Type | Description |
|---|---|
| IRegistersMessageProviders | The registration helper, so that calls may be chained. |
Remarks
Use this method, AddMessageProvidersInAssembly(Assembly) or AddMessageProvidersInAssemblies(Assembly[]) as a convenient way to add many validation message providers to your dependency injection container.
This method also registers the found message provider types so that they may be used with an IGetsCandidateMessageTypes.
AddMessageProvidersInAssemblies(Assembly[])
Scans the specified assemblies for validation message providers and registers every one of
them, so that they may be dependency-injected.
Declaration
public IRegistersMessageProviders AddMessageProvidersInAssemblies(params Assembly[] assemblies)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.Assembly[] | assemblies | A collection of assemblies to scan for validation message provider classes. |
Returns
| Type | Description |
|---|---|
| IRegistersMessageProviders | The registration helper, so that calls may be chained. |
Remarks
Use this method, AddMessageProvidersInAssembly(Assembly) or AddMessageProvidersInAssemblies(IEnumerable<Assembly>) as a convenient way to add many validation message providers to your dependency injection container.
This method also registers the found message provider types so that they may be used with an IGetsCandidateMessageTypes.
AddMessageProvidersInAssembly(Assembly)
Scans the specified assembly for validation message providers and registers every one of
them, so that they may be dependency-injected.
Declaration
public IRegistersMessageProviders AddMessageProvidersInAssembly(Assembly assembly)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.Assembly | assembly | An assembly to scan for validation message provider classes. |
Returns
| Type | Description |
|---|---|
| IRegistersMessageProviders | The registration helper, so that calls may be chained. |
Remarks
Use this method, AddMessageProvidersInAssemblies(Assembly[]) or AddMessageProvidersInAssemblies(IEnumerable<Assembly>) as a convenient way to add many validation message providers to your dependency injection container.
This method also registers the found message provider types so that they may be used with an IGetsCandidateMessageTypes.