Registering providers using assembly attributes
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:
using CMS;
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).
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.
Enabling class discovery
If your custom class is located in its own assembly (Class Library project), you need to make sure class discovery is enabled for the project. Otherwise the RegisterCustom attributes cannot work. See Adding custom assemblies.