Register custom providers

To replace the system implementations of custom providers, helpers, or managers with your custom ones, use 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 custom class extending the given object (obtained using the typeof notation).

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

Example


// Registers custom providers
[assembly: RegisterCustomProvider(typeof(CustomUserInfoProvider))]
[assembly: RegisterCustomProvider(typeof(CustomMemberInfoProvider))] 

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 Integrate custom code.