Class ValidatorHost
Default implementation of IHostsValidationFramework.
Inheritance
Implements
Inherited Members
Namespace: CSF.Validation
Assembly: CSF.Validation.Selfhosting.dll
Syntax
public class ValidatorHost : IHostsValidationFramework
Remarks
To create a new instance of this type please use the static Build(Action<IServiceCollection>, Action<ValidationOptions>) method.
Properties
| Improve this Doc View SourceJsonSerializer
Gets an object which may be used to serialize instances of manifest model Value to/from JSON.
Declaration
public ISerializesManifestModelToFromJson JsonSerializer { get; }
Property Value
Type | Description |
---|---|
ISerializesManifestModelToFromJson |
ManifestFromBuilderProvider
Gets an object which may provide a ValidationManifest from a validator-builder.
Declaration
public IGetsManifestFromBuilder ManifestFromBuilderProvider { get; }
Property Value
Type | Description |
---|---|
IGetsManifestFromBuilder |
Remarks
Validator builders are types which implement IBuildsValidator<TValidated> and specify the definition/configuration of a validator in code. This is the recommended way of specifying validators.
ManifestFromModelProvider
Gets an object which may provide a ValidationManifest from a manifest model.
Declaration
public IGetsValidationManifestFromModel ManifestFromModelProvider { get; }
Property Value
Type | Description |
---|---|
IGetsValidationManifestFromModel |
Remarks
The manifest model is a simplified API, similar to a validation manifest but suitable for serializing to/from data such as relational databases or document structures such as JSON or XML. This provides a mechanism for specifying validators-as-data. validators.
ManifestValidator
Gets an object which may be used to validate a validation manifest.
Declaration
public IValidatesValidationManifest ManifestValidator { get; }
Property Value
Type | Description |
---|---|
IValidatesValidationManifest |
Remarks
This is essentially "a validator-validator". Particularly of use if you are manipulating validation manifests directly, or if you are using the manifest model. It allows developers to test their validators for common mistakes.
ValidatorFactory
Gets an object from which validator instances may be created.
Declaration
public IGetsValidator ValidatorFactory { get; }
Property Value
Type | Description |
---|---|
IGetsValidator |
Remarks
This is the primary property of use provided by IHostsValidationFramework. From here you may create validator instances from any of:
- Validator builders
- A validation manifest model
- A validation manifest
Validator builders are the recommended mechanism for creating validators. For more information please read the documentation website.
Methods
| Improve this Doc View SourceBuild(Action<IServiceCollection>, Action<ValidationOptions>)
Builds a new validator host and returns it. Parameters may be used to add & configure other services such as rules & message providers.
Declaration
public static IHostsValidationFramework Build(Action<IServiceCollection> serviceCollectionConfig = null, Action<ValidationOptions> optionsAction = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> | serviceCollectionConfig | An object permitting further configuration of the self-contained service collection. |
System.Action<ValidationOptions> | optionsAction | An optional configuration action permitting the setting of default validation options. |
Returns
Type | Description |
---|---|
IHostsValidationFramework | A self-hosting validation service locator object. |
Remarks
See other methods available upon ServiceCollectionExtensions for more information about how to register rules and/or message providers.
When using the self-hosting/self-contained validator host, the standard validation rules: UseStandardValidationRules(IServiceCollection) are always automatically added by default, as is the JSON serializer.