Class ValidatorBuilderContextFactory
A factory service for getting instances of ValidatorBuilderContext.
Inheritance
Implements
Inherited Members
Namespace: CSF.Validation.ValidatorBuilding
Assembly: CSF.Validation.dll
Syntax
public class ValidatorBuilderContextFactory : IGetsValidatorBuilderContext
Constructors
| Improve this Doc View SourceValidatorBuilderContextFactory(IStaticallyReflects)
Initialises a new instance of ValidatorBuilderContextFactory.
Declaration
public ValidatorBuilderContextFactory(IStaticallyReflects reflect)
Parameters
Type | Name | Description |
---|---|---|
CSF.Reflection.IStaticallyReflects | reflect | A service which provides static reflection. |
Methods
| Improve this Doc View SourceGetContextForCollection(ValidatorBuilderContext, Type)
Gets a validator builder context for validating items within a collection.
Declaration
public ValidatorBuilderContext GetContextForCollection(ValidatorBuilderContext collectionContext, Type collectionItemType)
Parameters
Type | Name | Description |
---|---|---|
ValidatorBuilderContext | collectionContext | A validation context representing the collection itself. |
System.Type | collectionItemType | The type of items within the collection. |
Returns
Type | Description |
---|---|
ValidatorBuilderContext | A validation builder context. |
GetContextForMember<TValidated, TValue>(Expression<Func<TValidated, TValue>>, ValidatorBuilderContext)
Gets the validator builder context for validating values of a specified member of a validated object.
Declaration
public ValidatorBuilderContext GetContextForMember<TValidated, TValue>(Expression<Func<TValidated, TValue>> memberAccessor, ValidatorBuilderContext validatorContext)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TValidated, TValue>> | memberAccessor | An expression which indicates the member of |
ValidatorBuilderContext | validatorContext | Contextual information relating to how a validator is built. |
Returns
Type | Description |
---|---|
ValidatorBuilderContext | A context object for building a validator. |
Type Parameters
Name | Description |
---|---|
TValidated | The type of the primary object under validation. |
TValue | The type of the member being validated. |
GetContextForValue<TValidated, TValue>(Func<TValidated, TValue>, ValidatorBuilderContext)
Gets the validator builder context for validating values that have been retrieved from a validated object.
Declaration
public ValidatorBuilderContext GetContextForValue<TValidated, TValue>(Func<TValidated, TValue> valueAccessor, ValidatorBuilderContext validatorContext)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TValidated, TValue> | valueAccessor | An accessor function which gets the value to be validated from a |
ValidatorBuilderContext | validatorContext | Contextual information relating to how a validator is built. |
Returns
Type | Description |
---|---|
ValidatorBuilderContext | A context object for building a validator. |
Type Parameters
Name | Description |
---|---|
TValidated | The type of the primary object under validation. |
TValue | The type of the retrieved value being validated. |
GetPolymorphicContext(ValidatorBuilderContext, Type)
Gets a validator context for polymorphic validation of a derived type.
Declaration
public ValidatorBuilderContext GetPolymorphicContext(ValidatorBuilderContext validatorContext, Type derivedType)
Parameters
Type | Name | Description |
---|---|---|
ValidatorBuilderContext | validatorContext | Contextual information relating to how a validator is built. |
System.Type | derivedType | The derived type for which the polymorphic context will be used. |
Returns
Type | Description |
---|---|
ValidatorBuilderContext | A context object for building a validator. |