3

I need to add a second sql data provider to our screwturn wiki, i added the connection the web config but can't seem to add it to the startup. I have...

 public static string GetSettingsStorageProviderConfiguration2()
 {
     string config = WebConfigurationManager.AppSettings["SettingsStorageProviderConfig2"];
     if (config != null) return config;
     else return "";
 }

Then in startup I have duplicated the host and settings provider info, this is probably redundant but i'm not sure how to do it otherwise...

 Host Host2  = new Host();

 ISettingsStorageProviderV30 ssp2 = ProviderLoader.LoadSettingsStorageProvider(WebConfigurationManager.AppSettings["SettingsStorageProvider2"]);
 ssp2.Init(Host2, GetSettingsStorageProviderConfiguration2());

 Collectors.SettingsProvider2 = ssp2;

I updated TryLogin with

 IUsersStorageProviderV30 connection2 = Collectors.UsersProviderCollector.GetProvider(StartupTools.GetSettingsStorageProviderConfiguration()) as IUsersStorageProviderV30;

 //IUsersStorageProviderV30[] providers2 = 
 // Then try all other providers
 List<IUsersStorageProviderV30> providers =  Collectors.UsersProviderCollector.AllProviders.OfType<IUsersStorageProviderV30>().ToList();
 providers.Add(connection2);

But I'm missing something to make connection2 not return null.

Am I way out in left field here? Is there a easier way to go about this?

Radim Köhler
  • 122,561
  • 47
  • 239
  • 335

0 Answers0