Interface IValidationEntry<T>
Defines members to be implemented by a type that allows configuring validation rules for a property.
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public interface IValidationEntry<T>
Type Parameters
| Name | Description |
|---|---|
| T | Type of the selected property. |
Methods
| Edit this page View SourceAddRule(Func<T, bool>, string)
Adds a validation rule for the selected property.
Declaration
IValidationEntry<T> AddRule(Func<T, bool> rule, string error)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, bool> | rule | Function that performs the validation. The function must return true if the value passes the test, false otherwise. |
| string | error | Error message to display if the rule fails. |
Returns
| Type | Description |
|---|---|
| IValidationEntry<T> | The same validation-entry instance to allow Fluent syntax. |
AddRule(Func<T, bool?>, string)
Adds a validation rule for the selected property.
Declaration
IValidationEntry<T> AddRule(Func<T, bool?> rule, string error)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, bool?> | rule | Function that performs the validation. The function must return true if the value passes the test, false otherwise. If the evaluator returns null, evaluation of any remaining rules that have not yet run will stop. |
| string | error | Error message to display if the rule fails. |
Returns
| Type | Description |
|---|---|
| IValidationEntry<T> | The same validation-entry instance to allow Fluent syntax. |