Show / Hide Table of Contents

Class ValidatorHost

Default implementation of IHostsValidationFramework.

Inheritance
System.Object
ValidatorHost
Implements
IHostsValidationFramework
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

JsonSerializer

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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 Source

Build(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.

Implements

IHostsValidationFramework
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX