protected void ClearPropertyToValidate <T>(Expression <Func <T> > propertyExpression) { string propertyName = PropertySupport.ExtractPropertyName(propertyExpression); PropertyInfo property = ThisType.GetProperty(propertyName); if (property != null) { m_PropertiesToValidate.Remove(property); } }
protected void AddPropertyToValidate <T>( Expression <Func <T> > propertyExpression, ValidationRule validation) { string propertyName = PropertySupport.ExtractPropertyName(propertyExpression); PropertyInfo property = ThisType.GetProperty(propertyName); if (property != null) { IList <ValidationRule> validations; if (!m_PropertiesToValidate.TryGetValue(property, out validations)) { validations = new List <ValidationRule>(new[] { validation }); m_PropertiesToValidate.Add(property, validations); } if (!validations.Contains(validation)) { validations.Add(validation); } } }