Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Populating a ProviderCollection from custom config in beta 2

I'm a little lost. I'm not clear on how to populate a ProviderCollection based on a custom configuration section. The way I first learned it (pre-beta) isn't possible anymore, and of course all of the docs appear to be placeholders.

For example, in web.config, I have something like this:

<mySection defaultProvider="PopForums">
        <providers>
            <add name="MyProvider" type="MyProvider, MyAssy" connectionStringName="Whatever" />
        </providers>
</mySection>


Then my custom config section looks something like:

public class MySection : ConfigurationSection
{
   [ConfigurationProperty("defaultProvider", DefaultValue = "Whatevah")]
   public string DefaultProvider
   {
      get { return (string)base["defaultProvider"]; }
      set { base["defaultProvider"] = value; }
   }

   [ConfigurationProperty("providers", RequiredValue = false)]
   public ProviderCollection Providers
   {
       get { return (ProviderCollection)base["providers"]; }
   }
}


Now how do I get this stuff initialized? The code I'm revisiting from a year ago doesn't even compile because the classes I used, some of them anyway, are gone. I can't find any newer examples.

2 Comments

Comments have been disabled for this content.