Show / Hide Table of Contents

Class ValidatorFactory

A service which gets a validator from any of a number of mechanisms.

Inheritance
System.Object
ValidatorFactory
Implements
IGetsValidator
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.dll
Syntax
public class ValidatorFactory : IGetsValidator

Constructors

| Improve this Doc View Source

ValidatorFactory(IServiceProvider)

Initialises a new instance of ValidatorFactory.

Declaration
public ValidatorFactory(IServiceProvider serviceProvider)
Parameters
Type Name Description
System.IServiceProvider serviceProvider

A service provider.

Exceptions
Type Condition
System.ArgumentNullException

If the serviceProvider is null.

Methods

| Improve this Doc View Source

GetValidator(ValidationManifest)

Gets a validator instance using a specified validation manifest. A validation manifest is a model which may specify a validator using data.

Declaration
public IValidator GetValidator(ValidationManifest manifest)
Parameters
Type Name Description
ValidationManifest manifest

The validation manifest.

Returns
Type Description
IValidator

A validator implementation.

Exceptions
Type Condition
System.ArgumentNullException

If the manifest is null.

ValidatorBuildingException

If the manifest is not valid to create a validator instance.

| Improve this Doc View Source

GetValidator(Value, Type)

Gets a validator instance using a specified validation manifest. A validation manifest is a model which may specify a validator using data. This overload uses a simplified/serialization-friendly model.

Declaration
public IValidator GetValidator(Value manifestModel, Type validatedType)
Parameters
Type Name Description
Value manifestModel

A simplified validation manifest model.

System.Type validatedType

The type of object to be validated.

Returns
Type Description
IValidator

A validator implementation.

Exceptions
Type Condition
System.ArgumentNullException

If the manifestModel is null.

ValidatorBuildingException

If the manifestModel is not valid to create a validator instance.

| Improve this Doc View Source

GetValidator(Type)

Gets a validator instance using a specified builder type which specifies a validator via code.

Declaration
public IValidator GetValidator(Type builderType)
Parameters
Type Name Description
System.Type builderType

The type of a class which implements IBuildsValidator<TValidated> for the desired validated type.

Returns
Type Description
IValidator

A validator implementation.

Exceptions
Type Condition
System.ArgumentNullException

If the builderType is null.

System.ArgumentException

If the builderType is not a concrete (non-abstract) class derived from IBuildsValidator<TValidated> or if it implements that interface more than once for different generic types.

| Improve this Doc View Source

GetValidator<TValidated>(IBuildsValidator<TValidated>)

Gets a validator instance using a specified validator-builder instance which specifies a validator via code.

Declaration
public IValidator<TValidated> GetValidator<TValidated>(IBuildsValidator<TValidated> builder)
Parameters
Type Name Description
IBuildsValidator<TValidated> builder

An instance of a validator-builder.

Returns
Type Description
IValidator<TValidated>

A strongly-typed validator implementation.

Type Parameters
Name Description
TValidated

The type of object to be validated.

Implements

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