/// <summary> /// Set Property Filters constructor via ConfigurationSection from configuration file /// </summary> /// <param name="section">ConfigurationSection from configuration file</param> public PropertyFilter(ConfigurationSection section) : this() { //initialize fields if (section == null) { return; } foreach (KeyValueConfigurationElement keyVal in ((AppSettingsSection)section).Settings) { if (string.IsNullOrEmpty(keyVal.Value)) { continue; } switch (keyVal.Key.ToUpper()) { case "EQUALTO": EqualTo.AddRange(keyVal.Value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); break; case "STARTWITH": StartWith.AddRange(keyVal.Value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); break; case "CONTAIN": Contain.AddRange(keyVal.Value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); break; case "PROPERTYSETSEQUALTO": PropertySetsEqualTo.AddRange(keyVal.Value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); break; default: #if DEBUG Debug.WriteLine(string.Format("Invalid Key - {0}", keyVal.Key.ToUpper())); #endif break; } } }
/// <summary> /// Set Property Filters constructor /// </summary> /// <param name="equalTo">';' delimited string for property names to equal</param> /// <param name="startWith">';' delimited string for property names to start with</param> /// <param name="contain">';' delimited string for property names containing</param> /// <param name="pSetEqualTo">';' delimited string for Property Set names to equal</param> public PropertyFilter(string equalTo, string startWith, string contain, string pSetEqualTo) : this() { //Property names to exclude if (!string.IsNullOrEmpty(equalTo)) { EqualTo.AddRange(equalTo.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); } if (!string.IsNullOrEmpty(startWith)) { StartWith.AddRange(startWith.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); } if (!string.IsNullOrEmpty(contain)) { Contain.AddRange(contain.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); } //PropertySet names to exclude if (!string.IsNullOrEmpty(pSetEqualTo)) { PropertySetsEqualTo.AddRange(pSetEqualTo.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => s.ToUpper())); } }