Interface IValidationRule
Represents a validation rule.
public interface IValidationRule
- Extension Methods
Remarks
The system uses this interface to process validation rules. For defining custom validation rules, inherit the ValidationRule<TProperties, TClientProperties, TValue> class.
Properties
Result
Represents a result of Validate(object, IFormFieldValueProvider) method.
ValidationResult Result { get; }
Property Value
Remarks
Result is set by Validate(TValue, IFormFieldValueProvider) method and shouldn't be set directly by the validation rule except the custom initial value within the validation rule constructor.
Methods
GetClientProperties()
Returns validation rule client properties defined by validation rule implementation.
Task<ValidationRuleClientProperties> GetClientProperties()
Returns
GetProperties()
Returns validation rule configuration properties.
ValidationRuleProperties GetProperties()
Returns
SetProperties(ValidationRuleProperties)
Sets the validation rule configuration properties.
void SetProperties(ValidationRuleProperties properties)
Parameters
properties
ValidationRuleProperties
Validate(object, IFormFieldValueProvider)
Validates value
and sets the validation result into the Result property.
Task Validate(object value, IFormFieldValueProvider formFieldValueProvider)
Parameters
value
objectValue to be validated.
formFieldValueProvider
IFormFieldValueProviderProvider of values of other form fields for contextual validation.
Returns
- Task
Remarks
Sets Result's validation result with IsValid set to true, if value is valid. Otherwise sets Result with the flag set to false and a corresponding error message.