November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi Paul,
These are just resolved through dependency injection, in fact, if you look at the VisitorGroupCriterionAttribute you can see it implements the ServicePlugInAttributeBase
.
That means that ejecting the registered instances should make them unavailable. It's not that obvious how to do this via StructureMap, but I quickly tested the following and it seems to work (no guarantees!):
[InitializableModule]
[ModuleDependency(typeof(DependencyResolverInitialization))]
public class RemoveVisitorGroupCriteriaInitialization : IConfigurableModule
{
public void Initialize(InitializationEngine context) { }
public void Uninitialize(InitializationEngine context) { }
public void ConfigureContainer(ServiceConfigurationContext context)
{
// If you wanted to remove all criteria
//context.Services.RemoveAll<ICriterion>();
// Remove selected criteria
var criteriaTypes = new List<Type>
{
// Site Criteria
typeof(NumberOfVisitsCriterion),
typeof(SelectedLanguageCriterion),
typeof(UserProfileCriterion),
typeof(ViewedCategoriesCriterion),
typeof(ViewedPagesCriterion),
// Time and Place Criteria
typeof(TimeOfDayCriterion)
};
var criterionPluginConfig = context.StructureMap().Model.PluginTypes
.SingleOrDefault(x => x.PluginType == typeof(ICriterion));
if (criterionPluginConfig == null)
{
return;
}
var instances = criterionPluginConfig.Instances.Where(x => criteriaTypes.Contains(x.ReturnedType));
foreach (var instance in instances)
{
criterionPluginConfig.EjectAndRemove(instance);
}
}
}
/Jake
Hi,
I am currently on Episerver 11.6 and am looking to start using the personalization in Episerver.
Creating custom Criteria classes is very simple. I've created several of my own, but would like to hide some of the built in ones. Is it possible to hide specific built in personalization criterias?
-Paul