private void FillPropertyToRule() { Type currentType = GetType(); PropertyInfo[] properties = currentType.GetProperties(); foreach (PropertyInfo property in properties) { IEnumerable <ValidateRuleAttribute> attributes = property.GetCustomAttributes <ValidateRuleAttribute>(); ICollection <Rule> rules = new List <Rule>(); foreach (ValidateRuleAttribute attribute in attributes) { rules.Add(ruleProvider.ProvideRule(attribute.Rule)); } propertyToRule.Add(property.Name, rules); } }