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) {
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))