Try our conversational search powered by Generative AI!
AI OnAI Off
Int by itself is a primitive and not a reference type and as such will always have a value. In this case why not simply have an enum with a "None" value which maps to 0 instead? You can then validate against the value of None when making your decisions.
e.g.
public enum VisitorGroup
{
None = 0,
ValueOne,
ValueTwo
}
I noticed an issue that prevents the website from starting if you have a criterion model with an enum type property and use the EnumSelectionFactory(or a custom one):
Invalid cast from 'System.Int32' to 'CustomerName.Corporate.Salesforce.FinancialServiceCloud.Enums.VisitorGroup'.
This is the model class(reduced to the essential):
So both properties are optional which means i need to support Nullable<VisitorGroup>. That is a custom enum, so don't confuse it with the class EPiServer.Personalization.VisitorGroups.VisitorGroup.
I have found a workaround. I will split this criterion into two where both properties are required in each. But i wonder how to support nullable enums in visitor-group-criteria.