The most direct way to register custom providers, helpers or managers is using assembly attributes.
Edit your provider class.
Add a using statement for the CMS namespace:
- Register your custom providers by adding assembly attributes above the class declaration, for providers, helpers or managers respectively:
The parameter of each attribute must contain the exact type of the corresponding custom class (specified as a System.Type object).
If your custom class is located in its own assembly (Class Library project), you need to perform the following steps to ensure that the RegisterCustom attributes work correctly:
- Open the solution in Visual Studio.
- Ensure that your project has a reference to the CMS.Core dll (located in the Lib folder of the Kentico project).
Edit your custom assembly's AssemblyInfo.cs file (in the Properties folder).
Add the AssemblyDiscoverable assembly attribute:
- 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.
Was this page helpful?