예제 #1
0
        private object GetPropertyValue(object source, ConfigurationClassCollectionPropertyDefinition propertyModel)
        {
            var collection = propertyModel.GetPropertyValue(source) as IEnumerable ?? new List <object>();

            var result = new List <object>();

            foreach (var item in collection)
            {
                var itemValue = BuildObject(item, propertyModel.ConfigurationProperties);
                result.Add(itemValue);
            }

            return(result);
        }
        private void UpdateOptions(object source, ConfigurationClassCollectionPropertyDefinition model, IEnumerable <ConfigurationSet> configurationSets, ConfigurationIdentity configIdentity)
        {
            var items = model.GetPropertyValue(source) as IEnumerable;

            if (items == null)
            {
                var collectionBuilder = model.GetCollectionBuilder();
                model.SetPropertyValue(source, collectionBuilder.Collection);
                return;
            }
            foreach (var item in items)
            {
                UpdateOptions(item, model.ConfigurationProperties, configurationSets, configIdentity);
            }
        }