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)); } }
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; }
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)); }
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); }