Merge pull request #350 from robwilkens/bug1089
[mono.git] / mcs / class / System.Configuration / System.Configuration / ConfigurationSectionGroup.cs
index 9f8da3e4a00e4d6ef258654364ddee14ddf1f77b..4b212c54a499d92e7fe5a3c52b9ac1d2e420dafb 100644 (file)
@@ -45,9 +45,22 @@ namespace System.Configuration
                public ConfigurationSectionGroup ()
                {
                }
-               
+
+               Configuration Config {
+                       get {
+                               if (config == null)
+                                       throw new InvalidOperationException ("ConfigurationSectionGroup cannot be edited until it is added to a Configuration instance as its descendant");
+                               return config;
+                       }
+               }
+
+               bool initialized;
+
                internal void Initialize (Configuration config, SectionGroupInfo group)
                {
+                       if (initialized)
+                               throw new SystemException ("INTERNAL ERROR: this configuration section is being initialized twice: " + GetType ());
+                       initialized = true;
                        this.config = config;
                        this.group = group;
                }
@@ -58,13 +71,23 @@ namespace System.Configuration
                }
 
                [MonoTODO]
-               public void RequireDeclaration (bool require)
+               public void ForceDeclaration (bool require)
                {
                        this.require_declaration = require;
                }
 
+               public void ForceDeclaration ()
+               {
+                       ForceDeclaration (true);
+               }
+               
                [MonoTODO]
                public bool IsDeclared {
+                       get { return false; }
+               }
+
+               [MonoTODO]
+               public bool IsDeclarationRequired {
                        get { return require_declaration; }
                }
 
@@ -72,25 +95,26 @@ namespace System.Configuration
                        get { return name; }
                }
 
-               public string Path {
+               [MonoInternalNote ("Check if this is correct")]
+               public string SectionGroupName {
                        get { return group.XPath; }
                }
 
                public ConfigurationSectionGroupCollection SectionGroups {
                        get {
-                               if (groups == null) groups = new ConfigurationSectionGroupCollection (config, group);
+                               if (groups == null) groups = new ConfigurationSectionGroupCollection (Config, group);
                                return groups;
                        }
                }
 
                public ConfigurationSectionCollection Sections {
                        get {
-                               if (sections == null) sections = new ConfigurationSectionCollection (config, group);
+                               if (sections == null) sections = new ConfigurationSectionCollection (Config, group);
                                return sections;
                        }
                }
 
-               public string TypeName {
+               public string Type {
                        get { return type_name;}
                        set { type_name = value; }
                }