Try our conversational search powered by Generative AI!

Trying to use the ContentReferenceList property but getting exception


I'm trying to use a very simple ContentReferenceList like this:

public virtual IList MediaFiles { get; set; }

But I am getting the exception:

System.NotSupportedException: The type System.Collections.Generic.IList`1[[EPiServer.Core.ContentReference, EPiServer, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]] can not be mapped to a MetaDataType

Seems like this should be simple - so hopefully I've missed something obvious?

[I'm using Episerver CMS v11.9.3]

Aug 17, 2018 4:42

Well, that was a pretty silly post.. Forgot that this is on a Product so is the Commerce content provider which won't have compatibility for things like PropertyList! Oops, I'll leave this here for future me in case I do the same thing again :)

Aug 17, 2018 5:38

If you add the attribute


To your property it will work. All the ILists work as long as you set the correct backing types so that commerce knows the correct meta data field to map to

Aug 17, 2018 9:52

Commerce contents have full support for IList<T> - well, except for inside blocks (which is coming soon). However you need to specify a BackingType as Scott said 

Aug 17, 2018 10:13

Oh, in that case I’ll give that a try. I often run into weird limitations with Commerce content so just assumed this was another. Thanks Scott and Quan for the replies!

Aug 17, 2018 12:29

Just follow up message to say Scott and Quan were right :) 

My property as follows works well:

Name = "Media files",
GroupName = SystemTabNames.Content,
Order = 130)]
public virtual IList<ContentReference> MediaFiles { get; set; }

Thanks again.

Aug 18, 2018 10:56
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.