public void Remove(string name) { this.VerifyIsAttachedToConfigRecord(); this._configRecord.RemoveConfigurationSectionGroup(this._configSectionGroup.SectionGroupName, name); string key = BaseConfigurationRecord.CombineConfigKey(this._configSectionGroup.SectionGroupName, name); if (!this._configRecord.SectionFactories.Contains(key)) { base.BaseRemove(name); } }
// Remove the declaration and definition of a section in this config file, including any // location sections in the file. This will also remove any descendant sections and // section groups. // // Note that if the section group is declared in a parent, we still remove the declaration and // definition, and the instance of ConfigurationSectionGroup will be detached from the collection. // However, the collection will still have a ConfigurationSectionGroup of that name in the collection, // only it will have the value of the immediate parent. public void Remove(string name) { VerifyIsAttachedToConfigRecord(); _configRecord.RemoveConfigurationSectionGroup(_configSectionGroup.SectionGroupName, name); // Remove the section from the collection if it is no longer in the list of all SectionGroupFactories. string configKey = BaseConfigurationRecord.CombineConfigKey(_configSectionGroup.SectionGroupName, name); if (!_configRecord.SectionFactories.Contains(configKey)) { BaseRemove(name); } }
public ConfigurationSectionGroup Get(string name) { this.VerifyIsAttachedToConfigRecord(); if (string.IsNullOrEmpty(name)) { throw ExceptionUtil.ParameterNullOrEmpty("name"); } if (name.IndexOf('/') >= 0) { return(null); } string configKey = BaseConfigurationRecord.CombineConfigKey(this._configSectionGroup.SectionGroupName, name); return(this._configRecord.GetSectionGroup(configKey)); }
// Remove the declaration and definition of a section in this config file, including any // location sections in the file. // // Note that if the section is declared in a parent, we still remove the declaration and // definition, and the instance of ConfigurationSection will be detached from the collection. // However, the collection will still have a ConfigurationSection of that name in the collection, // only it will have the value of the immediate parent. public void Remove(string name) { VerifyIsAttachedToConfigRecord(); // Remove the factory and section from this record, so that when config is written, // it will contain neither a declaration or definition. _configRecord.RemoveConfigurationSection(_configSectionGroup.SectionGroupName, name); // Remove the section from the collection if it is no longer in the list of all SectionFactories. string configKey = BaseConfigurationRecord.CombineConfigKey(_configSectionGroup.SectionGroupName, name); if (!_configRecord.SectionFactories.Contains(configKey)) { BaseRemove(name); } }
public ConfigurationSection Get(string name) { VerifyIsAttachedToConfigRecord(); // validate name if (string.IsNullOrEmpty(name)) { throw ExceptionUtil.ParameterNullOrEmpty(nameof(name)); } // prevent GetConfig from returning config not in this collection if (name.IndexOf('/') >= 0) { return(null); } // get the section from the config record string configKey = BaseConfigurationRecord.CombineConfigKey(_configSectionGroup.SectionGroupName, name); return((ConfigurationSection)_configRecord.GetSection(configKey)); }
public ConfigurationSectionGroup Get(string name) { VerifyIsAttachedToConfigRecord(); // validate name if (string.IsNullOrEmpty(name)) { throw ExceptionUtil.ParameterNullOrEmpty(nameof(name)); } // prevent GetConfig from returning config not in this collection if (name.IndexOf('/') >= 0) // string.Contains(char) is .NetCore2.1+ specific { return(null); } // get the section group string configKey = BaseConfigurationRecord.CombineConfigKey(_configSectionGroup.SectionGroupName, name); return(_configRecord.GetSectionGroup(configKey)); }