private object GetConfigPropertyValueFromInput(JObject source, ConfigurationPrimitiveCollectionPropertyDefinition propertyModel, ConfigurationIdentity configIdentity, IEnumerable <ConfigurationSet> requiredConfigurationSets) { var collectionBuilder = propertyModel.GetCollectionBuilder(); foreach (var item in source.GetValue(propertyModel.ConfigurationPropertyName.ToLowerCamelCase())) { var result = item.ToObject(propertyModel.PropertyType); collectionBuilder.Add(result); } return(collectionBuilder.Collection); }
private string GetPropertyType(ConfigurationPrimitiveCollectionPropertyDefinition definition) { if (IsIntergerType(definition.PropertyType)) { return(ConfigurationPropertyType.IntergerCollection); } if (definition.PropertyType == typeof(string)) { return(ConfigurationPropertyType.StringCollection); } return(ConfigurationPropertyType.Unacceptable); }
private ConfigurationPropertyPayload BuildProperty(ConfigurationPrimitiveCollectionPropertyDefinition value) { var propertyType = propertyTypeProvider.GetPropertyType(value); return(new ConfigurationPropertyPayload { PropertyName = value.ConfigurationPropertyName.ToLowerCamelCase(), PropertyDisplayName = value.PropertyDisplayName, PropertyType = propertyType, ValidationDefinition = value.ValidationRules, PropertyDescription = value.PropertyDescription, Options = propertyType == ConfigurationPropertyType.Enum ? BuildEnumOption(value.PropertyType) : new Dictionary <string, string>() }); }
private static ConfigurationIntegerCollectionPropertyBuilder <TConfig> IntegerPrimitiveCollection <TModel, TConfig>(this IModelWithProperties <TModel> source, Expression <Func <TModel, ICollection <TConfig> > > expression) where TConfig : IComparable { var body = ExpressionHelper.GetExpressionBody(expression); ConfigurationPropertyModelBase value; if (!source.ConfigurationProperties.TryGetValue(body.Member.Name, out value) || !(value is ConfigurationPrimitiveCollectionPropertyDefinition)) { var type = body.Type; if (type == typeof(ICollection <TConfig>)) { type = typeof(List <TConfig>); } var definition = new ConfigurationPrimitiveCollectionPropertyDefinition <TConfig>(body.Member.Name, typeof(TConfig), typeof(TModel), type); value = definition; source.ConfigurationProperties[value.ConfigurationPropertyName] = value; } var builder = new ConfigurationIntegerCollectionPropertyBuilder <TConfig>((ConfigurationPrimitiveCollectionPropertyDefinition)value); return(builder); }
internal ConfigurationPrimitiveCollectionPropertyBuilder(ConfigurationPrimitiveCollectionPropertyDefinition definition) : base(definition) { this.definition = definition; }