2008-12-06 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / class / System.Configuration / System.Configuration / ProviderSettings.cs
index e97066597c7f8ec23c2cde2a4f47f377116af442..efbf00bdc41c1abece4444daa4bf69856fdabb51 100644 (file)
@@ -3,7 +3,8 @@
 //
 // Authors:
 //     Duncan Mak (duncan@ximian.com)
-//  Lluis Sanchez Gual (lluis@novell.com)
+//      Lluis Sanchez Gual (lluis@novell.com)
+//      Chris Toshok (toshok@ximian.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -24,7 +25,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004,2005 Novell, Inc (http://www.novell.com)
 //
 
 #if NET_2_0
@@ -37,26 +38,22 @@ namespace System.Configuration
 {
        public sealed class ProviderSettings: ConfigurationElement
        {
-               static ConfigurationPropertyCollection properties;
-               static ConfigurationPropertyCollection keys;
+               ConfigNameValueCollection parameters;
+
                static ConfigurationProperty nameProp;
                static ConfigurationProperty typeProp;
-               
-               ConfigNameValueCollection parameters;
-               
+               static ConfigurationPropertyCollection properties;
+
                static ProviderSettings ()
                {
-                       nameProp = new ConfigurationProperty ("name", typeof(string), null);
-                       typeProp = new ConfigurationProperty ("type", typeof(string), null);
-                       
+                       nameProp = new ConfigurationProperty ("name", typeof (string), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
+                       typeProp = new ConfigurationProperty ("type", typeof (string), null, ConfigurationPropertyOptions.IsRequired);
                        properties = new ConfigurationPropertyCollection ();
+
                        properties.Add (nameProp);
                        properties.Add (typeProp);
-                       
-                       keys = new ConfigurationPropertyCollection ();
-                       keys.Add (nameProp);
                }
-               
+
                public ProviderSettings ()
                {
                }
@@ -67,19 +64,7 @@ namespace System.Configuration
                        Type = type;
                }
                
-               protected internal override ConfigurationPropertyCollection CollectionKeyProperties {
-                       get {
-                               return keys;
-                       }
-               }
-               
-               protected internal override ConfigurationPropertyCollection Properties {
-                       get {
-                               return properties;
-                       }
-               }
-
-               protected override bool HandleUnrecognizedAttribute (string name, string value)
+               protected override bool OnDeserializeUnrecognizedAttribute (string name, string value)
                {
                        if (parameters == null)
                                parameters = new ConfigNameValueCollection ();
@@ -93,9 +78,9 @@ namespace System.Configuration
                        return (parameters != null && parameters.IsModified) || base.IsModified ();
                }
 
-               protected internal override void Reset (ConfigurationElement parentElement, object context)
+               protected internal override void Reset (ConfigurationElement parentElement)
                {
-                       base.Reset (parentElement, context);
+                       base.Reset (parentElement);
 
                        ProviderSettings sec = parentElement as ProviderSettings;
                        if (sec != null && sec.parameters != null)
@@ -105,23 +90,28 @@ namespace System.Configuration
                }
 
                [MonoTODO]
-               protected internal override void UnMerge (
+               protected internal override void Unmerge (
                                ConfigurationElement source, ConfigurationElement parent,
-                               bool serializeCollectionKey, object context,
-                               ConfigurationUpdateMode updateMode)
+                               ConfigurationSaveMode updateMode)
                {
-                       base.UnMerge (source, parent, serializeCollectionKey, context, updateMode);
+                       base.Unmerge (source, parent, updateMode);
                }
                
+               [ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
                public string Name {
                        get { return (string) this [nameProp]; }
                        set { this [nameProp] = value; }
                }
                
+               [ConfigurationProperty ("type", Options = ConfigurationPropertyOptions.IsRequired)]
                public string Type {
                        get { return (string) this [typeProp]; }
                        set { this [typeProp] = value; }
                }
+
+               protected internal override ConfigurationPropertyCollection Properties {
+                       get { return properties; }
+               }
                
                public NameValueCollection Parameters {
                        get {