public override void GetConfig(bool refresh, ChoConfigSectionObjectMap configSectionObjectMap) { _configSection = ChoConfigurationManager.GetConfig(ConfigElementName, refresh) as IChoConfigSectionable; if (_configSection != null) { _configSection.Init(configSectionObjectMap); } }
public virtual void Init(ChoConfigSectionObjectMap configSectionObjectMap) { if (configSectionObjectMap == null) { throw new ArgumentNullException("configSectionObjectMap"); } configSectionObjectMap.ConfigSection = this; }
public override void PersistConfig(ChoConfigSectionObjectMap configSectionObjectMap) { if (_configSection == null) { return; } _configSection.Persist(configSectionObjectMap); }
public override void Persist(ChoConfigSectionObjectMap configSectionObjectMap) { StringBuilder config = new StringBuilder(); Hashtable keyValues = configSectionObjectMap.ToHashtable(); foreach (string key in keyValues.Keys) { if (keyValues[key] != null) { config.AppendFormat("<add key=\"{0}\" value=\"{1}\" />{2}", key, keyValues[key].ToString(), Environment.NewLine); } } File.WriteAllText(_configPath, ChoXmlDocument.SetInnerXml(_configPath, ConfigSectionName, config.ToString())); }
public abstract void Persist(ChoConfigSectionObjectMap configSectionObjectMap);
public override void Init(ChoConfigSectionObjectMap configSectionObjectMap) { base.Init(configSectionObjectMap); //configSectionObjectMap.ConfigFilePath = ConfigPath; configSectionObjectMap.ConfigObject = ConfigObject; }
public override void Persist(ChoConfigSectionObjectMap configSectionObjectMap) { File.WriteAllText(_configPath, ChoXmlDocument.SetOuterXml(_configPath, ConfigSectionName, ChoObject.ToXmlString(configSectionObjectMap.ConfigObject))); }