Пример #1
0
        internal void CreateSectionGroup(SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec)
        {
            if (parentGroup.HasChild(name))
            {
                throw new ConfigurationErrorsException(
                          "Cannot add a ConfigurationSectionGroup. A section or section group already exists with the name '" +
                          name + "'");
            }
            if (sec.Type == null)
            {
                sec.Type = _system.Host.GetConfigTypeName(sec.GetType());
            }
            sec.SetName(name);

            var section = new SectionGroupInfo(name, sec.Type)
            {
                StreamName = FileName,
                ConfigHost = _system.Host
            };

            parentGroup.AddChild(section);
            _elementData[section] = sec;

            sec.Initialize(this, section);
        }
Пример #2
0
		internal void CreateSectionGroup (SectionGroupInfo parentGroup, string name, ConfigurationSectionGroup sec)
		{
			if (parentGroup.HasChild (name)) throw new ConfigurationErrorsException ("Cannot add a ConfigurationSectionGroup. A section or section group already exists with the name '" + name + "'");
			if (sec.Type == null) sec.Type = system.Host.GetConfigTypeName (sec.GetType ());
			sec.SetName (name);

			SectionGroupInfo section = new SectionGroupInfo (name, sec.Type);
			section.StreamName = streamName;
			section.ConfigHost = system.Host;
			parentGroup.AddChild (section);
			elementData [section] = sec;

			sec.Initialize (this, section);
		}