private ValidationResult ValidateProperty(object target, ConfigurationCollectionPropertyDefinition propertyModel) { var results = new List <ValidationResult>(); var propertyValue = propertyModel.GetPropertyValue(target) as IEnumerable; foreach (var value in propertyValue) { results.Add(ValidateProperties(value, propertyModel.ConfigurationProperties)); } return(new ValidationResult(results)); }
private ValidationResult ValidateProperty(object target, ConfigurationCollectionPropertyDefinition propertyModel, ConfigurationIdentity configIdentity, IEnumerable <ConfigurationSet> configurationSets) { var results = new List <ValidationResult>(); var propertyValue = propertyModel.GetPropertyValue(target) as IEnumerable; var duplicateChecker = new HashSet <string>(); foreach (var value in propertyValue) { if (propertyModel.HasUniqueKey) { var key = propertyModel.GetKeyFromMember(value); if (!duplicateChecker.Add(key)) { results.Add(new ValidationResult(ValidationStrings.DuplicateKeys(propertyModel.ConfigurationPropertyName, key))); } } results.Add(ValidateProperties(value, propertyModel.ConfigurationProperties, configIdentity, configurationSets)); } return(new ValidationResult(results)); }