2 // System.Configuration.ProviderSettings.cs
5 // Duncan Mak (duncan@ximian.com)
6 // Lluis Sanchez Gual (lluis@novell.com)
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
34 using System.Collections.Specialized;
36 namespace System.Configuration
38 public sealed class ProviderSettings: ConfigurationElement
40 ConfigNameValueCollection parameters;
42 public ProviderSettings ()
46 public ProviderSettings (string name, string type)
52 protected override bool OnDeserializeUnrecognizedAttribute (string name, string value)
54 if (parameters == null)
55 parameters = new ConfigNameValueCollection ();
56 parameters [name] = value;
57 parameters.ResetModified ();
61 protected internal override bool IsModified ()
63 return (parameters != null && parameters.IsModified) || base.IsModified ();
66 protected internal override void Reset (ConfigurationElement parentElement)
68 base.Reset (parentElement);
70 ProviderSettings sec = parentElement as ProviderSettings;
71 if (sec != null && sec.parameters != null)
72 parameters = new ConfigNameValueCollection (sec.parameters);
78 protected internal override void Unmerge (
79 ConfigurationElement source, ConfigurationElement parent,
80 bool serializeCollectionKey, ConfigurationSaveMode updateMode)
82 base.Unmerge (source, parent, serializeCollectionKey, updateMode);
85 [ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
87 get { return (string) this ["name"]; }
88 set { this ["name"] = value; }
91 [ConfigurationProperty ("type", Options = ConfigurationPropertyOptions.IsRequired)]
93 get { return (string) this ["type"]; }
94 set { this ["type"] = value; }
97 public NameValueCollection Parameters {
99 if (parameters == null)
100 parameters = new ConfigNameValueCollection ();