Create the installer class

The installer class executes logic on application start and performs the following operations: 

  • Register the resources
  • Add the criterion to the personalization configuration
  • Register the evaluator class
  • Create a user segment
  • Create and personalize a sample page

Create the Installer class

To create the class, perform the following:

  1. In Visual Studio, open the context menu of the DayOfWeekPersonalization project and click Add » Class
  2. Name the class file Installer.cs and click Add.
  3. In the Installer class, add method PreApplicationStart.
  4. Subscribe for the Bootstrapper_Initialized event that is fired after initialization of the Sitefinity CMS application.
  5. Add the worker methods which execute their logic on the Sitefinity CMS application start.

Use the following code sample:

Edit the AssemblyInfo class

Open the AssemblyInfo.cs class, which is located in the Properties folder of the DayOfWeekPersonalization project, add the following code:
[assembly: PreApplicationStartMethod(typeof(Installer), "PreApplicationStart")]

Thus, the PreApplicationStart method in the Installer class is called on application start of any Sitefinity CMS project by ASP.NET. 

Reference the class library

Finally, you need to reference your custom personalization - the DayOfWeekPersonalization class library, in your Sitefinity CMS application.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?