Class ExpressValidatorBuilder<TObj>
- 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,
along with validation rules.
public class ExpressValidatorBuilder<TObj> : IExpressValidatorBuilder<TObj>
Type Parameters
TObj
A type of object to validate.
- Inheritance
-
ExpressValidatorBuilder<TObj>
- Implements
-
IExpressValidatorBuilder<TObj>
- Inherited Members
- Extension Methods
Constructors
ExpressValidatorBuilder(OnFirstPropertyValidatorFailed)
public ExpressValidatorBuilder(OnFirstPropertyValidatorFailed validationMode = OnFirstPropertyValidatorFailed.Continue)
Parameters
validationMode
OnFirstPropertyValidatorFailed
Methods
AddField<T>(Expression<Func<TObj, T>>)
Add field to validate.
public IBuilderWithPropValidator<TObj, T> AddField<T>(Expression<Func<TObj, T>> func)
Parameters
func
Expression<Func<TObj, T>>An expression to get field.
Returns
- IBuilderWithPropValidator<TObj, T>
Type Parameters
T
A type of
TObj
object field.
AddFunc<T>(Func<TObj, T>, string, Action<T>)
Add Func for object to get value to validate.
public IBuilderWithPropValidator<TObj, T> AddFunc<T>(Func<TObj, T> func, string propName, Action<T> onSuccessValidation = null)
Parameters
func
Func<TObj, T>Func for object
propName
stringA name of the property if the validation failed.
onSuccessValidation
Action<T>Specifies a method to execute when validation succeeds.
Returns
- IBuilderWithPropValidator<TObj, T>
Type Parameters
T
A type of value.
AddProperty<T>(Expression<Func<TObj, T>>)
Adds property to validate.
public IBuilderWithPropValidator<TObj, T> AddProperty<T>(Expression<Func<TObj, T>> func)
Parameters
func
Expression<Func<TObj, T>>An expression to get property.
Returns
- IBuilderWithPropValidator<TObj, T>
Type Parameters
T
A type of
TObj
object property.
Build()
Builds the IExpressValidator<TObj>.
public IExpressValidator<TObj> Build()
Returns
- IExpressValidator<TObj>