ソースを参照

2007-06-21 Nagappan A <[email protected]>

	* DbConnectionStringBuilder.cs (Init): Modified the dictionary to
	use StringComparer.InvariantCultureIgnoreCase.
	(Add, ContainsKey): Checks whether argument is null or empty string.


svn path=/trunk/mcs/; revision=80465
Nagappan Alagappan 18 年 前
コミット
354842e304

+ 6 - 0
mcs/class/System.Data/System.Data.Common/ChangeLog

@@ -1,3 +1,9 @@
+2007-06-21  Nagappan A  <[email protected]>
+
+	* DbConnectionStringBuilder.cs (Init): Modified the dictionary to
+	use StringComparer.InvariantCultureIgnoreCase.
+	(Add, ContainsKey): Checks whether argument is null or empty string.
+
 2007-05-08  Adar Wesley <[email protected]>
 
 	* DbProviderFactory.cs: minor refactoring for throwing exceptions

+ 8 - 2
mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs

@@ -59,7 +59,7 @@ namespace System.Data.Common
 
                 private void Init ()
                 {
-                        _dictionary = new Dictionary<string, object> ();
+                        _dictionary = new Dictionary <string, object> (StringComparer.InvariantCultureIgnoreCase);
                 }
 
                 #endregion // Constructors
@@ -130,7 +130,7 @@ namespace System.Data.Common
                                 if (ContainsKey (keyword))
                                         return _dictionary [keyword];
                                 else
-                                        throw new ArgumentException ();
+                                        throw new ArgumentException ("Keyword does not exist");
                         }
                         set { Add (keyword, value); }
                 }
@@ -171,6 +171,10 @@ namespace System.Data.Common
 
                 public void Add (string keyword, object value)
                 {
+			if (keyword == null || keyword.Trim () == "")
+				throw new ArgumentException ("Keyword should not be emtpy");
+			if (value == null)
+				throw new ArgumentException ("Keyword not supported", keyword);
                         if (ContainsKey (keyword)) {
                                 _dictionary [keyword] = value;
                         } else {
@@ -209,6 +213,8 @@ namespace System.Data.Common
 
                 public virtual bool ContainsKey (string keyword)
                 {
+			if (keyword == null)
+				throw new ArgumentNullException ("Invalid argument", keyword);
                         return _dictionary.ContainsKey (keyword);
                 }