Class ModelValidationHelper
Helper methods for validation.
public static class ModelValidationHelper
- Inheritance
-
ModelValidationHelper
- Inherited Members
Methods
ValidateProperty(object, string)
Validates a property using data annotation validation attributes.
public static string ValidateProperty(object entity, string propertyName)
Parameters
entity
objectThe entity containing the property to validate.
propertyName
stringThe name of the property to validate.
Returns
- string
A string containing all errors from failed validations, separated by new lines.
Examples
string IDataErrorInfo.Error
{
get { return null; }
}
string IDataErrorInfo.this[string columnName]
{
get { return ValidationHelpers.ValidateProperty(this, columnName); }
}
Remarks
This can be used to implement IDataErrorInfo.