Registering providers via the web.config

Registering custom providers, helpers or managers through your application’s web.config file allows you to switch between different providers (custom or default) without having to edit the web project’s code.

If you do not need your provider customizations to be adjustable through the web.config file, it is more efficient to register custom providers directly via the RegisterCustomProvider, RegisterCustomHelper or RegisterCustomManager assembly attributes (as described in Registering providers using assembly attributes).

  1. Edit your web.config file and add the following section into the <configSections> element:

    
    
    
     <!-- Extensibility BEGIN -->
       <section name="cms.extensibility" type="CMS.Base.CMSExtensibilitySection, CMS.Base" />
     <!-- Extensibility END -->
    
    
    
     

    This defines the cms.extensibility web.config section where you can register custom providers, helpers and managers.

  2. Create the actual <cms.extensibility> section directly under the root level of the web.config.

  3. Assign your custom classes to providers, helpers or managers via <add> elements with the following attributes:

    • name – must match the name of the provider/helper/manager class that you wish to customize.
    • assembly – specifies the assembly where your custom class is located.
    • type – specifies the name of your custom class (including namespaces).

You need to categorize the <add> elements under <providers>, <helpers> or <managers> sub-sections based on the type of the customized class.




<configuration>
...
<!-- Extensibility BEGIN -->
<cms.extensibility>
    <providers>
        <add name="EmailProvider" assembly="CustomProviders" type="CustomProviders.CustomEmailProvider" />
        <add name="SiteInfoProvider" assembly="CustomProviders" type="CustomProviders.CustomSiteInfoProvider" />
        ...
    </providers>
    <helpers>
        <add name="CacheHelper" assembly="CustomProviders" type="CustomHelpers.CustomCacheHelper" />
        ...
    </helpers>
    <managers>
        <add name="WorkflowManager" assembly="CustomProviders" type="CustomManagers.CustomWorkflowManager" />
        ...
    </managers>
</cms.extensibility>
<!-- Extensibility END -->
...

</configuration>


The registration is now complete.