2 // System.Configuration.ConnectionStringSettings.cs
5 // Sureshkumar T <tsureshkumar@novell.com>
9 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 #region Using directives
39 namespace System.Configuration
41 public sealed class ConnectionStringSettings : ConfigurationElement
45 private static ConfigurationPropertyCollection _properties;
46 private static ConfigurationPropertyCollection _keyProperties;
48 private static readonly ConfigurationProperty _propConnectionString;
49 private static readonly ConfigurationProperty _propName;
50 private static readonly ConfigurationProperty _propProviderName;
54 static ConnectionStringSettings ()
56 _properties = new ConfigurationPropertyCollection ();
57 _keyProperties = new ConfigurationPropertyCollection ();
58 _propName = new ConfigurationProperty ("name",
61 ConfigurationPropertyFlags.Required |
62 ConfigurationPropertyFlags.IsKey
65 _propProviderName = new ConfigurationProperty ("providerName",
68 ConfigurationPropertyFlags.Required
71 _propConnectionString = new ConfigurationProperty ("connectionString",
74 ConfigurationPropertyFlags.Required
77 _properties.Add (_propName);
78 _properties.Add (_propProviderName);
79 _properties.Add (_propConnectionString);
81 _keyProperties.Add (_propName);
84 public ConnectionStringSettings ()
85 : this (null, null, null)
89 public ConnectionStringSettings (string name, string connectionString)
90 : this (name, connectionString, null)
94 public ConnectionStringSettings (string name, string connectionString, string providerName)
97 ConnectionString = connectionString;
98 ProviderName = providerName;
100 #endregion // Constructors
104 protected internal override ConfigurationPropertyCollection CollectionKeyProperties
108 return _keyProperties;
111 protected internal override ConfigurationPropertyCollection Properties
120 get { return (string) base [_propName];}
121 set { base [_propName] = value; }
124 public string ProviderName
126 get { return (string) base [_propProviderName]; }
127 set { base [_propProviderName] = value; }
130 public string ConnectionString
132 get { return (string) base [_propConnectionString]; }
133 set { base [_propConnectionString] = value; }
136 #endregion // Properties