2007-04-18 Jeffrey Stedfast <fejj@novell.com>
[mono.git] / mcs / class / System.Data / System.Data.Common / DbProviderFactories.cs
index 308d048d83aac95f47cd3916dff72427acbb0614..dcd120306b3803569f7e4f567a64472c9a1f42e8 100644 (file)
@@ -43,66 +43,66 @@ namespace System.Data.Common {
        {
                private static object configEntries = null; // DataSet
 
-                private const string CONFIG_SECTION_NAME        = "system.data";
-                private const string CONFIG_SEC_TABLE_NAME      = "DbProviderFactories";
-                
+               internal const string CONFIG_SECTION_NAME        = "system.data";
+               internal const string CONFIG_SEC_TABLE_NAME      = "DbProviderFactories";
+
                #region Methods
 
                public static DbProviderFactory GetFactory (DataRow providerRow)
                {
-                        string assemblyType = (string) providerRow ["AssemblyQualifiedName"];
-#if TARGET_JVM // case insensitive GetType is not supported\r
-                        Type type = Type.GetType (assemblyType, false);
+                       string assemblyType = (string) providerRow ["AssemblyQualifiedName"];
+#if TARGET_JVM // case insensitive GetType is not supported
+                       Type type = Type.GetType (assemblyType, false);
 #else
-                        Type type = Type.GetType (assemblyType, false, true);
-#endif\r
-                        if (type != null && type.IsSubclassOf (typeof (DbProviderFactory))) {
-                                // Provider factories are singletons with Instance field having
-                                // the sole instance
-                                FieldInfo field = type.GetField ("Instance", BindingFlags.Public |
-                                                                 BindingFlags.Static);
-                                if (field != null) {
-                                        return field.GetValue (null) as DbProviderFactory;
-                                }
-                                
-                        }
-                        
-                        throw new ConfigurationException("DataProvider is missing!");
+                       Type type = Type.GetType (assemblyType, false, true);
+#endif
+                       if (type != null && type.IsSubclassOf (typeof (DbProviderFactory))) {
+                               // Provider factories are singletons with Instance field having
+                               // the sole instance
+                               FieldInfo field = type.GetField ("Instance", BindingFlags.Public |
+                                       BindingFlags.Static);
+                               if (field != null) {
+                                       return field.GetValue (null) as DbProviderFactory;
+                               }
+                       }
+
+                       throw new ConfigurationException("DataProvider is missing!");
                }
 
                public static DbProviderFactory GetFactory (string providerInvariantName)
                {
-                        DataTable table = GetFactoryClasses ();
-                        if (table != null) {
-                                DataRow row = table.Rows.Find (providerInvariantName);
-                                if (row != null)
-                                        return GetFactory (row);
-                        }
-                        throw new ConfigurationException ("DataProvider is not found!");
+                       DataTable table = GetFactoryClasses ();
+                       if (table != null) {
+                               DataRow row = table.Rows.Find (providerInvariantName);
+                               if (row != null)
+                                       return GetFactory (row);
+                       }
+                       throw new ConfigurationException ("DataProvider is not found!");
                }
 
                public static DataTable GetFactoryClasses ()
                {
-                        DataSet ds = GetConfigEntries ();
-                        DataTable table = ds != null ? ds.Tables [CONFIG_SEC_TABLE_NAME] : null;
-                        if (table != null)
-                                table = table.Copy (); // avoid modifications by user
-                        return table;
+                               DataSet ds = GetConfigEntries ();
+                               DataTable table = ds != null ? ds.Tables [CONFIG_SEC_TABLE_NAME] : null;
+                               if (table != null)
+                                       table = table.Copy (); // avoid modifications by user
+                               return table;
                }
 
                #endregion // Methods
 
                #region Internal Methods
+
                internal static DataSet GetConfigEntries ()
                {
-                        
-                        if (configEntries != null)
-                                return configEntries as DataSet;
-                        
-                        DataSet ds = (DataSet) ConfigurationSettings.GetConfig (CONFIG_SECTION_NAME);
-                        Interlocked.CompareExchange (ref configEntries, ds, null);
-                        return configEntries as DataSet;
+                       if (configEntries != null)
+                               return configEntries as DataSet;
+
+                       DataSet ds = (DataSet) ConfigurationManager.GetSection (CONFIG_SECTION_NAME);
+                       Interlocked.CompareExchange (ref configEntries, ds, null);
+                       return configEntries as DataSet;
                }
+
                #endregion Internal Methods
        }
 }