Use IndexOf (char)
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ProvidersHelper.cs
index 8b729bd9e21423f1aba55e249052405507bc6b38..e9b8dca4a8d064289ef8fbedfb5259ef09aa3db6 100644 (file)
@@ -37,26 +37,20 @@ using System.Data.Common;
 using System.Data.SqlClient;
 using System.IO;
 using System.Reflection;
+using System.Web;
 using System.Web.Compilation;
+using System.Collections.Specialized;
 
 namespace System.Web.Configuration {
 
        public static class ProvidersHelper
        {
-               private static string privateBinPath = null;
-               
                public static ProviderBase InstantiateProvider (ProviderSettings providerSettings, Type providerType)
                {
-                       Type settingsType = Type.GetType (providerSettings.Type);
-                       if (settingsType == null && Directory.Exists (PrivateBinPath)) {
-                               string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
-                               foreach (string s in binDlls) {
-                                       Assembly binA = Assembly.LoadFrom (s);
-                                       settingsType = binA.GetType (providerSettings.Type);
-                                       if (settingsType != null)
-                                               break;
-                               }
-                       }
+                       Type settingsType = HttpApplication.LoadType (providerSettings.Type);
+                       
+                       if (settingsType == null)
+                               settingsType = HttpApplication.LoadTypeFromBin (providerSettings.Type);
 
                        // check App_Code dlls
                        if (settingsType == null) {
@@ -84,23 +78,12 @@ namespace System.Web.Configuration {
 
                        ProviderBase provider = Activator.CreateInstance (settingsType) as ProviderBase;
 
-                       provider.Initialize (providerSettings.Name, providerSettings.Parameters);
+                       NameValueCollection col = new NameValueCollection (providerSettings.Parameters);
+                       provider.Initialize (providerSettings.Name, col);
 
                        return provider;
                }
 
-               private static string PrivateBinPath {
-                       get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
-
-                               AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = Path.Combine (setup.ApplicationBase, setup.PrivateBinPath);
-
-                               return privateBinPath;
-                       }
-               }
-
                public static void InstantiateProviders (ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
                {
                        if (!typeof (ProviderBase).IsAssignableFrom (providerType))