Try our conversational search powered by Generative AI!

Creating custom properties


Hi everyone,

Goal: Extend PropertyData and save complex types as JSON (or something else. Doesn't really matter.) in the database and use our own complex types as page properties.

Problem: It seems like EPiServer is ignoring the value in PropertyAgeLimitList and tries to cast IEnumerable<AgeLimit> to String. 

public class ActivityPage : SitePageData
    [BackingType(typeof(PropertyAgeLimitList))]                                                                  // Our own class which extends PropertyData
    [Display(Name = "Age", Description = "Choose an age group.", Order = 500)]
    [EditorDescriptor(EditorDescriptorType = typeof(EnumSelectMany<AgeLimit>))]            // SelectMany-wrapper
    public virtual IEnumerable<AgeLimit> Age { get; set; }

This is how we want to use our properties. We don't want to work with strings. We want strongly typed objects as properties. 

We've tried setting PropertyValueType to both String and IEnumerable<AgeLimit> and also the get-method of Value. No luck, but everything works when we change the signature og the page property to String instead of IEnumerable<AgeLimit>.

We don't want to create an extra property to parse the page property.

Best Regards,

// Anders & Vidar

Mar 04, 2014 12:10

This may give you more insight of upcoming things -

Edited, Mar 04, 2014 14:48
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.