Try our conversational search powered by Generative AI!

Type 'EPiServer.Core.MediaData' could not be mapped to a PropertyDefinitionType


Hi! We are upgrading commerce from v5.2 628 to 8.2.

In the new catalog UI, we don't see the Images, they are metafields of type "Image file" on Product (is is working in Commerce UI )

In code first aproach i get on mya CatalogProduct:

Type 'EPiServer.Core.MediaData' could not be mapped to a PropertyDefinitionType (or my custom ImageFile type)

[CatalogContentType(MetaClassName = "DefaultProduct")] public class CatalogProduct : ProductContent ... and so on

public virtual MediaData ProductImage1 { get; set; }

Is there a backing type?

Are we suppose to change way to attach images to a product? 

Dec 22, 2014 15:51

Hi Luc,

Convert your mediadata properties to use content references instead, then you add a UIHint attribute to it. Are you using the new media system or the old Commerce legacy asset system?



Dec 22, 2014 17:43


We don't support the image file metafield in Catalog UI. You'll need to use Commerce Manager to manage it.

And if there is nothing prevents you from using new Asset system, we recommend to switch to it (use AssetMigrationTool to migrate files). And to use media in new Catalog UI, you can use ContentReference type as Toni suggested.



Dec 23, 2014 2:03

Thanks! I get it.

I can either use URL and ContentReference. ContentReference is to prefer what i understand.

I will use the new media system of course. 

We did not have any images/docs in old commerce "asset management", so when running AssetMigrationTool it didn't help converting the blob images saved on the product meta field.

I should probably make a script that; foreach product; save images in mediafiles/productfolder; connect it to assets on product; delete the old blobs; delete the old metafields;

I could use your example here

Is this a good idea?

Dec 23, 2014 9:30

It should work. You can also you the catalog content CommerceMediaCollection property, but you can stick with the DTO approach for similiarity.

Basic steps are:

- Use the code the convert the image file metafield to a normal media content

- Update the catalog content to include the reference to new media content. I would suggest to use CommerceMediaCollection instead of adding another ContentReference property to your catalog content.



Dec 23, 2014 9:58

Thanks, CommerceMediaCollection is the way to go.

Dec 23, 2014 10:34
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.