ValidationRuleMessage class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
Gets the messages of the validation rules, which are localized: the text of the TextKey of the attribute, else the text of its implied key, which its ErrorMessage is registered with, e.g. Db.Northwind.Customer.Quantity_ValidateRange, see GetTextKeySuffix, else its message as it is, else the default message of the rule, by its local text key, e.g. Validation.Range. The parameters of the rule are put in the message, e.g. {0} for the minimum of a range, unlike the messages of DataAnnotations, whose {0} is the name of the field, as a message of a form is displayed by the field.
public static class ValidationRuleMessage
Public Members
| name | description |
|---|---|
| const PropertyTextKeyItem | The key of the item of a ValidationContext that has the text key of the property being validated, e.g. Db.Northwind.Customer.Quantity, which the implied text keys of its rules start with. |
| static Failure(…) | Gets the result for an attribute whose value is not valid, with its message, see Format, for the member being validated. |
| static Format(…) | Gets the message of an attribute whose value is not valid. |
| static GetDefaultText(…) | Gets the invariant text of a default message, for when the local texts are not registered, e.g. in a unit test. |
| static GetImpliedTextKey(…) | Gets the implied text key of the message of a rule, which is the text key of the property being validated with the suffix of the rule, e.g. Db.Northwind.Customer.Quantity_ValidateRange, when the context has the text key of the property, see PropertyTextKeyItem, and the rule has one, see GetTextKeySuffix. |
See Also
- Source: ValidationRuleMessage.cs