2005-12-02 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Fri, 2 Dec 2005 23:46:12 +0000 (23:46 -0000)
committerChris Toshok <toshok@novell.com>
Fri, 2 Dec 2005 23:46:12 +0000 (23:46 -0000)
* CommaDelimitedStringCollectionConverter.cs (ConvertTo): change
the type check away from an exact check for
CommaDelimitedStringCollection to an assignable test from
StringCollection.  This is due to the fact that AuthorizationRule
doesn't create CommaDelimitedStringCollections, for some odd
reason.  It uses StringCollections.

* PropertyInformation.cs (Value): remove the case for
IsDefaultCollection - it's not necessary, as the property is an
Element.

* ConnectionStringSettings.cs: fix formatting and remove some
#regions.

* ConnectionStringSettingsCollection.cs: same.

* ConnectionStringsSection.cs: same.

* ConfigurationElement.cs (SerializeToXmlElement): don't write the
enclosing start/end elements if the elementName is null or "".
this fixes the case for the DefaultCollections (at least in the
case of connectionStrings).

* IgnoreSection.cs (Properties): remove the MonoTODO.

* SectionInfo.cs (WriteData): remove the "<!-- dd -->" output.

svn path=/trunk/mcs/; revision=53858

mcs/class/System.Configuration/System.Configuration/ChangeLog
mcs/class/System.Configuration/System.Configuration/CommaDelimitedStringCollectionConverter.cs
mcs/class/System.Configuration/System.Configuration/ConfigurationElement.cs
mcs/class/System.Configuration/System.Configuration/ConnectionStringSettings.cs
mcs/class/System.Configuration/System.Configuration/ConnectionStringSettingsCollection.cs
mcs/class/System.Configuration/System.Configuration/ConnectionStringsSection.cs
mcs/class/System.Configuration/System.Configuration/IgnoreSection.cs
mcs/class/System.Configuration/System.Configuration/PropertyInformation.cs
mcs/class/System.Configuration/System.Configuration/SectionInfo.cs

index c07659097a89176f882eec822a677efeb7f2aac2..208099a225042af2c8f68f846a173807b2acf814 100644 (file)
@@ -1,3 +1,32 @@
+2005-12-02  Chris Toshok  <toshok@ximian.com>
+
+       * CommaDelimitedStringCollectionConverter.cs (ConvertTo): change
+       the type check away from an exact check for
+       CommaDelimitedStringCollection to an assignable test from
+       StringCollection.  This is due to the fact that AuthorizationRule
+       doesn't create CommaDelimitedStringCollections, for some odd
+       reason.  It uses StringCollections.
+
+       * PropertyInformation.cs (Value): remove the case for
+       IsDefaultCollection - it's not necessary, as the property is an
+       Element.
+
+       * ConnectionStringSettings.cs: fix formatting and remove some
+       #regions.
+
+       * ConnectionStringSettingsCollection.cs: same.
+
+       * ConnectionStringsSection.cs: same.
+
+       * ConfigurationElement.cs (SerializeToXmlElement): don't write the
+       enclosing start/end elements if the elementName is null or "".
+       this fixes the case for the DefaultCollections (at least in the
+       case of connectionStrings).
+
+       * IgnoreSection.cs (Properties): remove the MonoTODO.
+
+       * SectionInfo.cs (WriteData): remove the "<!-- dd -->" output.
+
 2005-11-28  Chris Toshok  <toshok@ximian.com>
 
        * ProviderSettings.cs: use ConfigurationProperty's to implement
index f2e9c01178577323bbc7e121136cb54a4c029243..1ce8d3dc31e07cf0f419306b44dc2b8a64790901 100644 (file)
@@ -28,6 +28,7 @@
 
 #if NET_2_0
 
+using System.Collections.Specialized;
 using System.ComponentModel;
 using System.Globalization;
 
@@ -54,7 +55,7 @@ namespace System.Configuration
                {
                        if (value == null) return null;
 
-                       if (value.GetType() != typeof (CommaDelimitedStringCollection))
+                       if (!typeof (StringCollection).IsAssignableFrom (value.GetType()))
                                throw new ArgumentException ();
 
                        return value.ToString ();
index 423ff1128dab84c81d361cb748be026b248d0f4d..c9c817d20b8e5b8e6265cbbb2c41bad985855240 100644 (file)
@@ -443,9 +443,11 @@ namespace System.Configuration
                protected internal virtual bool SerializeToXmlElement (
                                XmlWriter writer, string elementName)
                {
-                       writer.WriteStartElement (elementName);
+                       if (elementName != null && elementName != "")
+                               writer.WriteStartElement (elementName);
                        bool res = SerializeElement (writer, false);
-                       writer.WriteEndElement ();
+                       if (elementName != null && elementName != "")
+                               writer.WriteEndElement ();
                        return res;
                }
 
index 8bcccf964cacda41a569ab32a63a865b5c5aa085..7310287af63562dcd37bc859f4120be116cfd076 100644 (file)
 
 #if NET_2_0
 
-#region Using directives
-
 using System;
 
-#endregion
-
 namespace System.Configuration
 {
         public sealed class ConnectionStringSettings : ConfigurationElement
         {
-
-                #region Fields
                 private static ConfigurationPropertyCollection _properties;
         
                 private static readonly ConfigurationProperty _propConnectionString;
                 private static readonly ConfigurationProperty _propName;
                 private static readonly ConfigurationProperty _propProviderName;
-                #endregion // Fields
 
-                #region Constructors
                 static ConnectionStringSettings ()
                 {
                         _properties     = new ConfigurationPropertyCollection ();
@@ -93,16 +85,10 @@ namespace System.Configuration
                         ConnectionString = connectionString;
                         ProviderName = providerName;
                 }
-                #endregion // Constructors
-
-                #region Properties
 
                 protected internal override ConfigurationPropertyCollection Properties
                 {
-                        get
-                        {
-                                return _properties;
-                        }
+                        get { return _properties; }
                 }
 
                [ConfigurationProperty ("name", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
@@ -125,8 +111,6 @@ namespace System.Configuration
                         get { return (string) base [_propConnectionString]; }
                         set { base [_propConnectionString] = value; }
                 }
-       
-                #endregion // Properties
                 
                 public override string ToString ()
                 {
index e48bf14164d6187a99c3b26dd902f45d2baa6180..20402e2d849315a3c53651c45e2cafa6e7fc39aa 100644 (file)
@@ -29,9 +29,7 @@
 
 #if NET_2_0
 
-#region Using directives
 using System;
-#endregion
 
 namespace System.Configuration
 {
@@ -40,17 +38,13 @@ namespace System.Configuration
         public sealed class ConnectionStringSettingsCollection : ConfigurationElementCollection
         {
 
-                #region Constructors
                 public ConnectionStringSettingsCollection () : base ()
                 {
                 }
-                #endregion // Constructors
 
-                #region Properties
                 public new ConnectionStringSettings this [string Name]
                 {
-                        get
-                        {
+                        get {
                                 foreach (ConfigurationElement c in this) {
                                         if (!(c is ConnectionStringSettings))
                                                 continue;
@@ -64,12 +58,8 @@ namespace System.Configuration
 
                 public new ConnectionStringSettings this [int index]
                 {
-                        get
-                        {
-                                return (ConnectionStringSettings) BaseGet (index);
-                        }
-                        set
-                        {
+                        get { return (ConnectionStringSettings) BaseGet (index); }
+                        set {
                                 if (BaseGet (index) != null)
                                         BaseRemoveAt (index);
                                 BaseAdd (index, value);
@@ -78,18 +68,15 @@ namespace System.Configuration
 
                [MonoTODO]
                protected internal override ConfigurationPropertyCollection Properties {
-                       get {
-                               return base.Properties;
-                       }
+                       get { return base.Properties; }
                }
 
-                #endregion // Properties
 
-                #region Methods
                 protected override ConfigurationElement CreateNewElement ()
                 {
                         return new ConnectionStringSettings ("", "", "");
                 }
+
                 protected override object GetElementKey (ConfigurationElement element)
                 {
                         return ((ConnectionStringSettings) element).Name;
@@ -99,22 +86,27 @@ namespace System.Configuration
                 {
                         BaseAdd ((ConfigurationElement) settings);
                 }
+
                 public void Clear ()
                 {
                         BaseClear ();
                 }
+
                 public int IndexOf (ConnectionStringSettings settings)
                 {
                         return BaseIndexOf (settings);
                 }
+
                 public void Remove (ConnectionStringSettings settings)
                 {
                         BaseRemove (settings.Name);
                 }
+
                 public void Remove (string name)
                 {
                         BaseRemove (name);
                 }
+
                 public void RemoveAt (int index)
                 {
                         BaseRemoveAt (index);
@@ -129,9 +121,6 @@ namespace System.Configuration
                                                                                  ((ConnectionStringSettings) element).Name));
                         this [index] = (ConnectionStringSettings) element;
                 }
-                
-                #endregion // Methods
-        
         }
 
 }
index ba36a5baa7158a99b7d2f31f5f622c6257e8f15f..5195721dff42d27d6ecce5821f9823ff17937fcb 100644 (file)
 
 #if NET_2_0
 
-#region Using directives
 using System;
 using System.Xml;
-#endregion
 
 namespace System.Configuration
 {
         public sealed class ConnectionStringsSection : ConfigurationSection
         {
-
-                #region Fields
                 private static readonly ConfigurationProperty _propConnectionStrings;
                 private static ConfigurationPropertyCollection _properties;
-                #endregion // Fields
 
-                #region Constructors
                 static ConnectionStringsSection ()
                 {
                         _propConnectionStrings = new ConfigurationProperty (null, typeof (ConnectionStringSettingsCollection), 
@@ -54,40 +48,22 @@ namespace System.Configuration
                         _properties = new ConfigurationPropertyCollection ();
                         _properties.Add (_propConnectionStrings);
                 }
-                public ConnectionStringsSection () : base ()
+
+                public ConnectionStringsSection ()
                 {
                 }
-                #endregion // Constructors
 
-                #region Properties
-               ConnectionStringSettingsCollection strings;
+
                [ConfigurationProperty ("", Options = ConfigurationPropertyOptions.IsDefaultCollection)]
                 public ConnectionStringSettingsCollection ConnectionStrings
                 {
-                        get {
-                               if (strings == null)
-                                       strings = new ConnectionStringSettingsCollection ();
-                               return strings;
-#if false
-                                return (ConnectionStringSettingsCollection) base [_propConnectionStrings];
-#endif
-                        }
+                       get { return (ConnectionStringSettingsCollection) base [_propConnectionStrings]; }
                 }
 
-               [MonoTODO ("this shouldn't be here, but it's necessary until the ConfigurationPropertyOptions.IsDefaultCollection stuff is hooked up properly.")]
-               protected internal override void DeserializeElement (XmlReader reader, bool serializeCollectionKey)
-               {
-                       ConnectionStrings.DeserializeElement (reader, serializeCollectionKey);
-               }
-
                 protected internal override ConfigurationPropertyCollection Properties
                 {
-                        get
-                        {
-                                return _properties;
-                        }
+                        get { return _properties; }
                 }
-                #endregion // Properties
 
             
                 protected internal override object GetRuntimeObject ()
index df38935c865c1b18edc000ed6d7cef3b3be53d2b..8a9f1962d22dc6de47233fd06d4118499bcdc975 100644 (file)
@@ -71,7 +71,6 @@ namespace System.Configuration {
                }
 
                ConfigurationPropertyCollection properties;
-               [MonoTODO]
                protected internal override ConfigurationPropertyCollection Properties {
                        get {
                                if (properties == null)
index a91e4a60d7e88806b11881ca69fa962b9ca3f49d..823945045d5ab5a30890d192d4fcce84f5b800bb 100644 (file)
@@ -115,14 +115,6 @@ namespace System.Configuration
                                                val = elem;
                                                origin = PropertyValueOrigin.Inherited;
                                        }
-                                       else if (property.IsDefaultCollection) {
-                                               ConfigurationElementCollection col = (ConfigurationElementCollection) Activator.CreateInstance (Type);
-                                               col.InitFromProperty (this);
-                                               if (owner != null && owner.IsReadOnly ())
-                                                       col.SetReadOnly ();
-                                               val = col;
-                                               origin = PropertyValueOrigin.Inherited;
-                                       }
                                        else {
                                                return DefaultValue;
                                        }
index bb22167fd530f520d3742d8d95fe63d0e6eb8731..06f4fe37f2a4f586ddca54c66e8b41e8d63dee3f 100644 (file)
@@ -171,7 +171,7 @@ namespace System.Configuration
                                xml = section.SerializeSection (parentSection, Name, mode);
                        }
                        else {
-                               xml = config.GetSectionXml (this)  + " <!-- dd -->";
+                               xml = config.GetSectionXml (this);
                        }
                        
                        if (xml != null) {