London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

ContentArea typeof with interface

Vote:
 

Hi all i have structre like on the image:
diagram

My BaseArticle Page has content are that looks like this:

        [AllowedTypes(typeof(AgrifirmArticlePage), typeof(NuscienceArticlePage))]
        public virtual IList RelatedItems { get; set; }

My question is why i can't use IRelatedItem or IRelatedItemWithColor inside AllowedTypes. Also when i put BaseArticle page, it will work only for SiteA not for SiteB aritlce pages ( i guess this is due to some cache). 
I saw in alloy that there is one contentarea that uses allowtypes and IContent is passed as type, so i am wondering what i'm doing wrong ?

Kind Regards
Nemanja

#172282
Nov 29, 2016 11:00
Vote:
 

Hi! You can, but you need to register them through a UI descriptor, like this:

[UIDescriptorRegistration]
public class RelatedItemUIDescriptor : UIDescriptor<IRelatedItem>
{
}

Then AllowedTypes should work. You can also change other types of behavior in the descriptor, please see http://world.episerver.com/documentation/Class-library/?documentId=cms/8/F39A57F.

#172299
Nov 29, 2016 17:58
Vote:
 

Hi Johan,

This work. Thanks for the help.

Nemanja

#172326
Nov 30, 2016 9:58
* 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.