Registering providers using assembly attributes

The most direct way to register custom providers, helpers or managers is using assembly attributes.

  1. Edit your provider class.

  2. Add a using statement for the CMS namespace:

     using CMS;
  3. Register your custom providers by adding assembly attributes above the class declaration, for providers, helpers or managers respectively:

    • RegisterCustomProvider
    • RegisterCustomHelper
    • RegisterCustomManager

The parameter of each attribute must contain the exact type of the corresponding custom class (specified as a System.Type object).

You can assign classes from both App_Code and other assemblies. If your custom class is located in an external assembly, you need to perform the following steps to ensure that the RegisterCustom attributes work correctly:

  1. Open the solution in Visual Studio.

  2. Ensure that your project has a reference to the CMS.Core dll (located in the Lib folder of the Kentico project).

  3. Edit your custom assembly’s AssemblyInfo.cs file (in the Properties folder).

  4. Add the AssemblyDiscoverable assembly attribute:

  5. Save the file and Build the custom project.

The customization automatically targets the provider object that matches the parent of the specified custom class.


// Registers two custom providers, a helper and a manager
[assembly: RegisterCustomProvider(typeof(CustomShippingOptionInfoProvider))]
[assembly: RegisterCustomProvider(typeof(CustomProviders.CustomForumPostInfoProvider))]
[assembly: RegisterCustomHelper(typeof(CustomCacheHelper))]
[assembly: RegisterCustomManager(typeof(CustomWorkflowManager))]

The system now uses your customized providers instead of the default functionality.