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:
- In Visual Studio, open the context menu of the DayOfWeekPersonalization project and click Add » Class
- Name the class file Installer.cs and click Add.
- In the Installer class, add method
PreApplicationStart
.
- Subscribe for the Bootstrapper_Initialized event that is fired after initialization of the Sitefinity CMS application.
- 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.