private object UpdateObject(ConfigInstance original, JContainer newEditPayload, ConfigurationModel model, ConfigurationIdentity configIdentity, IEnumerable <ConfigurationSet> requiredConfigurationSets)
 {
     if (original is ConfigCollectionInstance collection)
     {
         return(UpdateObject(collection, (JArray)newEditPayload, (ConfigurationOptionModel)model, configIdentity, requiredConfigurationSets));
     }
     else
     {
         return(UpdateObject(original.ConstructNewConfiguration(), (JObject)newEditPayload, model.ConfigurationProperties, configIdentity, requiredConfigurationSets));
     }
 }
예제 #2
0
        public object MapToEditConfig(ConfigInstance config, ConfigurationModel configModel)
        {
            var source = config.GetConfiguration();

            return(BuildObject(source, configModel));
        }
        private static ConfigInstance BuildConfigInstance(ConfigurationIdentity identity, ConfigurationModel model, object config)
        {
            ConfigInstance instance;

            if (model is ConfigurationOptionModel)
            {
                instance = ConfigFactory.CreateGenericCollectionInstance(model.Type, identity);
            }
            else
            {
                instance = ConfigFactory.CreateGenericInstance(model.Type, identity);
            }
            instance.SetConfiguration(config);
            return(instance);
        }
        public ConfigInstance MapToConfigInstance(string value, ConfigurationIdentity identity, ConfigurationModel model)
        {
            var config = ToObjectOrDefault(value, model);

            return(BuildConfigInstance(identity, model, config));
        }
 internal ConfigurationModelBuilder(ConfigurationModel definition)
 {
     this.definition = definition;
 }
예제 #6
0
        public object MapUploadToEditModel(string json, ConfigurationIdentity identity, ConfigurationModel model)
        {
            var uploadedInstance = uploadMapper.MapToConfigInstance(json, identity, model);

            if (uploadedInstance.GetConfiguration() == null)
            {
                uploadedInstance.SetConfiguration(uploadedInstance.ConstructNewConfiguration());
            }
            return(configurationEditModelMapper.MapToEditConfig(uploadedInstance, model));
        }
예제 #7
0
        private static ConfigInstance BuildConfigInstance(UpdateConfigurationSetFromJsonUploadCommand command, ConfigurationModel model, object config)
        {
            ConfigInstance instance;

            if (model is ConfigurationOptionModel)
            {
                instance = ConfigFactory.CreateGenericCollectionInstance(model.Type, command.Identity);
            }
            else
            {
                instance = ConfigFactory.CreateGenericInstance(model.Type, command.Identity);
            }
            instance.SetConfiguration(config);
            return(instance);
        }