Merge pull request #350 from robwilkens/bug1089
[mono.git] / mcs / class / System.Configuration / System.Configuration / ConfigurationSectionGroup.cs
index ae2b7598a37a7df56e513b2f51baf2e342d59181..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;
                }
@@ -70,7 +83,7 @@ namespace System.Configuration
                
                [MonoTODO]
                public bool IsDeclared {
-                       get { throw new NotImplementedException (); }
+                       get { return false; }
                }
 
                [MonoTODO]
@@ -82,21 +95,21 @@ namespace System.Configuration
                        get { return name; }
                }
 
-               [MonoTODO ("Check if this is correct")]
+               [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;
                        }
                }