Merge pull request #644 from knocte/connstrings
[mono.git] / mcs / class / System.Configuration / System.Configuration / ElementInformation.cs
index d6c628d2cc3a14a6d088e255c4ec372808db9022..7e5c729ce22302e4285ec6cde4083e81c15fe784 100644 (file)
 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 
-#if NET_2_0
 using System.Collections;
 
 namespace System.Configuration
 {
        public sealed class ElementInformation
        {
-               PropertyInformation propertyInfo;
-               ConfigurationElement owner;
-               PropertyInformationCollection properties;
-               
+               readonly PropertyInformation propertyInfo;
+               readonly ConfigurationElement owner;
+               readonly PropertyInformationCollection properties;
+
                internal ElementInformation (ConfigurationElement owner, PropertyInformation propertyInfo)
                {
                        this.propertyInfo = propertyInfo;
                        this.owner = owner;
+
+                       properties = new PropertyInformationCollection ();
+                       foreach (ConfigurationProperty prop in owner.Properties)
+                               properties.Add (new PropertyInformation (owner, prop));
                }
 
                [MonoTODO]
@@ -58,9 +61,9 @@ namespace System.Configuration
                        get { return propertyInfo != null ? propertyInfo.IsLocked : false; }
                }
                
-               [MonoTODO]
+               [MonoTODO("Support multiple levels of inheritance")]
                public bool IsPresent {
-                       get { return propertyInfo != null; }
+                       get { return owner.IsElementPresent; }
                }
                
                public int LineNumber {
@@ -76,18 +79,11 @@ namespace System.Configuration
                }
                
                public ConfigurationValidatorBase Validator {
-                       get { return propertyInfo != null ? propertyInfo.Validator : null; }
+                       get { return propertyInfo != null ? propertyInfo.Validator : new DefaultValidator(); }
                }
                
                public PropertyInformationCollection Properties {
-                       get {
-                               if (properties == null) {
-                                       properties = new PropertyInformationCollection ();
-                                       foreach (ConfigurationProperty prop in owner.Properties)
-                                               properties.Add (new PropertyInformation (owner, prop));
-                               }
-                               return properties; 
-                       }
+                       get { return properties; }
                }
                
                internal void Reset (ElementInformation parentInfo)
@@ -99,4 +95,4 @@ namespace System.Configuration
                }
        }
 }
-#endif
+