Create the evaluator class

After you prepare the project, you implement the evaluator class. The evaluator class is a class that is used to determine whether the current user is a match for the specified criterion.

The evaluator class must implement the ICriterionEvaluator interface. To create the evaluator class:

  1. In Visual Studio, open the context menu of the DayOfWeekPersonalization project and click Add » Class.
  2. Name the class file DayOfWeekEvaluator.cs and click Add.
  3. Make the DayOfWeekEvaluator class implement the ICriterionEvaluator interface.
  4. Define the CurrentDayOfWeek property.
    You get the current day of the week represented as a System.DayOfWeek enum, convert it to an integer number and then return the value.
  5. Implement the ICriterionEvaluator interface.
    The value of the current day of the week is compared with the value that you configure as a criterion. If the values match, the personalized version of the page is displayed. Otherwise, the default page is displayed.

Use the following code sample:

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?

Next article

Create the editor view