Register custom providers

To replace the system implementations of provider or helper classes with your custom ones, use assembly attributes:

  1. Edit your provider class.

  2. Add a using statement for the CMS namespace:

    C#
    
     using CMS;
     
  3. Register your custom providers by adding assembly attributes above the class declaration:

    • RegisterCustomProvider
    • RegisterCustomHelper

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.

C#
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.