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.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. 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?