November Happy Hour will be moved to Thursday December 5th.

Class CriterionBase<T>

An abstract class for a visitor group criterion using strongly typed settings and automatically generated user interface

Namespace: EPiServer.Personalization.VisitorGroups
Assembly: EPiServer.Framework.AspNetCore.dll
Version: 12.0.3
Syntax
public abstract class CriterionBase<T> : Object, ICriterion, IGeneratesAdministrativeInterface where T : class, ICriterionModel, new()
Type Parameters
Name Description
T

The type of model/settings to operate on.

Constructors

CriterionBase()

Declaration
protected CriterionBase()

Properties

Model

Gets the model for this criterian instance.

Declaration
public T Model { get; }
Property Value
Type Description
T

The model.

Methods

Initialize(VisitorGroupCriterion)

Initializes the criterion with the provided settings or creates new settings.

Declaration
public virtual void Initialize(VisitorGroupCriterion visitorGroupCriterion)
Parameters
Type Name Description
VisitorGroupCriterion visitorGroupCriterion

The stored visitor group for this criterion.

IsMatch(IPrincipal, HttpContext)

Determines whether the specified principal and/or context matches the criteria.

Declaration
public abstract bool IsMatch(IPrincipal principal, HttpContext httpContext)
Parameters
Type Name Description
System.Security.Principal.IPrincipal principal

The principal.

Microsoft.AspNetCore.Http.HttpContext httpContext

The HTTP context.

Returns
Type Description
System.Boolean

true if the specified principal is match; otherwise, false.

Subscribe(ICriterionEvents)

Called when a criterion instance is initialized. An instance has here the opportunity to subscribe to desired events.

Declaration
public virtual void Subscribe(ICriterionEvents criterionEvents)
Parameters
Type Name Description
ICriterionEvents criterionEvents

The criterion notifier.

Remarks

Any event subscribed to in this method should be unsubscribed in method Unsubscribe. The reason for this is that otherwise there will be "dangling" event handlers.

Unsubscribe(ICriterionEvents)

Called when a criterion is unloaded, for example because it seetings has been updated. Here any events subscribed to in method Subscribe should be unsubscribed to to avoid "dangling" event handlers.

Declaration
public virtual void Unsubscribe(ICriterionEvents criterionEvents)
Parameters
Type Name Description
ICriterionEvents criterionEvents

The criterion notifier.

Explicit Interface Implementations

IGeneratesAdministrativeInterface.ModelType

This class supports the EPiServer infrastructure and is not intended to be used directly from your code.

Declaration
Type IGeneratesAdministrativeInterface.ModelType { get; }
Returns
Type Description
System.Type
Remarks

This is basically a way for the rendering runtime to get hold of the generic type that was specified for the model as part of this class.

Implements

Extension Methods