Class ExpressValidatorBuilder<TObj, TOptions>
- Namespace
- ExpressValidator
- Assembly
- ExpressValidator.dll
Represents the class that creates an object that implements IExpressValidatorBuilder<TObj>by using the collection of TObj properties to validate and TOptions, along with validation rules.
public class ExpressValidatorBuilder<TObj, TOptions> : IExpressValidatorBuilder<TObj, TOptions>
Type Parameters
TObjA type of object to validate.
TOptionsA type of the options to use when creating an object that implements the IExpressValidator<TObj>.
- Inheritance
-
ExpressValidatorBuilder<TObj, TOptions>
- Implements
-
IExpressValidatorBuilder<TObj, TOptions>
- Inherited Members
- Extension Methods
Constructors
ExpressValidatorBuilder(OnFirstPropertyValidatorFailed)
public ExpressValidatorBuilder(OnFirstPropertyValidatorFailed validationMode = OnFirstPropertyValidatorFailed.Continue)
Parameters
validationModeOnFirstPropertyValidatorFailed
Methods
AddField<T>(Expression<Func<TObj, T>>)
public IBuilderWithPropValidator<TObj, TOptions, T> AddField<T>(Expression<Func<TObj, T>> func)
Parameters
funcExpression<Func<TObj, T>>
Returns
- IBuilderWithPropValidator<TObj, TOptions, T>
Type Parameters
T
AddFunc<T>(Func<TObj, T>, string, Action<T>)
Add Func for object to get value to validate.
public IBuilderWithPropValidator<TObj, TOptions, T> AddFunc<T>(Func<TObj, T> func, string propName, Action<T> onSuccessValidation = null)
Parameters
funcFunc<TObj, T>Func for object.
propNamestringA name of the property if the validation failed.
onSuccessValidationAction<T>Specifies a method to execute when validation succeeds.
Returns
- IBuilderWithPropValidator<TObj, TOptions, T>
Type Parameters
TA type of value.
AddMember<T>(Expression<Func<TObj, T>>)
Adds a property or field to validate. Use this when the member kind (property vs field) is not known at the call site, or to simplify call sites that previously had to choose between AddProperty<T>(Expression<Func<TObj, T>>) and AddField<T>(Expression<Func<TObj, T>>). Throws ArgumentException if the expression does not resolve to a property or field.
public IBuilderWithPropValidator<TObj, TOptions, T> AddMember<T>(Expression<Func<TObj, T>> func)
Parameters
funcExpression<Func<TObj, T>>An expression to get the property or field.
Returns
- IBuilderWithPropValidator<TObj, TOptions, T>
Type Parameters
TA type of
TObjobject property or field.
AddProperty<T>(Expression<Func<TObj, T>>)
Adds property to validate.
public IBuilderWithPropValidator<TObj, TOptions, T> AddProperty<T>(Expression<Func<TObj, T>> func)
Parameters
funcExpression<Func<TObj, T>>An expression to get property.
Returns
- IBuilderWithPropValidator<TObj, TOptions, T>
Type Parameters
TA type of
TObjobject property.
Build(TOptions)
Builds the IExpressValidator<TObj>.
public IExpressValidator<TObj> Build(TOptions options)
Parameters
optionsTOptions
Returns
- IExpressValidator<TObj>