Class PredicateValidator<T>
Defines a generic data validator that performs custom validation logic based on the value.
Inheritance
System.Object
PredicateValidator<T>
Implements
Namespace: MADE.Data.Validation.Validators
Assembly: MADE.Data.Validation.dll
Syntax
public class PredicateValidator<T> : object, IValidator
Type Parameters
Name | Description |
---|---|
T | The type of value being validated. |
Constructors
| Improve this Doc View SourcePredicateValidator()
Initializes a new instance of the PredicateValidator<T> class.
Declaration
public PredicateValidator()
PredicateValidator(Func<T, Boolean>)
Initializes a new instance of the PredicateValidator<T> class with the custom validation logic.
Declaration
public PredicateValidator(Func<T, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<T, System.Boolean> | predicate | The logic for performing validation on the value. |
Properties
| Improve this Doc View SourceFeedbackMessage
Gets or sets the feedback message to display when IsInvalid is true.
Declaration
public virtual string FeedbackMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsDirty
Gets or sets a value indicating whether the data is dirty.
Declaration
public bool IsDirty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInvalid
Gets or sets a value indicating whether the data provided is in an invalid state.
Declaration
public bool IsInvalid { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Key
Gets or sets the key associated with the validator.
Declaration
public string Key { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Predicate
Gets or sets the logic for performing validation on the value.
Declaration
public Func<T, bool> Predicate { get; set; }
Property Value
Type | Description |
---|---|
Func<T, System.Boolean> |
Methods
| Improve this Doc View SourceValidate(Object)
Executes data validation on the provided value
.
Declaration
public void Validate(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to be validated. |