Interface IGetsValidatorBuilderContext
An object which gets ValidatorBuilderContext instances for a number of common scenarios.
Namespace: CSF.Validation.ValidatorBuilding
Assembly: CSF.Validation.dll
Syntax
public interface IGetsValidatorBuilderContext
Methods
| Improve this Doc View SourceGetContextForCollection(ValidatorBuilderContext, Type)
Gets a validator builder context for validating items within a collection.
Declaration
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
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
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
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. |