private object GetConfigMultipleOptionPropertyValueFromInput(JObject source, ConfigurationPropertyWithMultipleOptionValuesModelDefinition propertyModel, ConfigurationIdentity configIdentity, IEnumerable <ConfigurationSet> requiredConfigurationSets) { var collectionBuilder = propertyModel.GetCollectionBuilder(); var optionSet = optionSetFactory.Build(propertyModel, configIdentity, requiredConfigurationSets); foreach (var key in source.GetValue(propertyModel.ConfigurationPropertyName.ToLowerCamelCase()).Select(s => s.ToObject(propertyModel.PropertyType))) { if (optionSet.ContainsKey(key)) { collectionBuilder.Add(key); } } return(collectionBuilder.Collection); }
private void UpdateMultipleOptions(object source, ConfigurationPropertyWithMultipleOptionValuesModelDefinition model, IEnumerable <ConfigurationSet> configurationSets, ConfigurationIdentity configIdentity) { var optionSet = optionSetFactory.Build(model, configIdentity, configurationSets); var collectionBuilder = model.GetCollectionBuilder(); var items = model.GetPropertyValue(source) as IEnumerable; foreach (var item in items ?? Enumerable.Empty <object>()) { if (optionSet.ContainsKey(item)) { collectionBuilder.Add(item); } } model.SetPropertyValue(source, collectionBuilder.Collection); }