We are creating all-new schemas/views/models as per our project's requirements. One of our schemas is a bit complex because of the vast requirements that we have. Here is a basic structure:

Schema 1 :

1st field: title

2nd field: component link to schema 2, schema 3, media item or an ECL item

Now, when we create a component using schema 1, schema 2 and schema 3, everything works fine and the view is able to render everything correctly. But the moment we include a media item or an ECL item, our model starts throwing an error "No Semantic mapping between schema 2 and media item" Or "No semantic mapping between schema 3 and media item".

There is no direct relationship between schema 2/3 and media item/ECL item. They are just allowed schemas for schema 1.

We have registered all the needed views or models appropriately after looking at this.

Any suggestions?

Update 1:

While debugging, we see that the error is thrown in SemanticSchema.cs -> function GetModelTypeFromSemanticMapping and the reason is that the baseModelType being passed and the mappedModelTypes do not match. The mappedModelType is actually correct and is what it should be as per the component created. But the baseModelType being passed is incorrect and belongs to one of the other schemas (Schema 3, in this case).

Update 2: I had simplified the scenario a bit in my original question but here is the structure that we have: Schema 1:

public class Menu : EntityModel
    public List<MenuItems> menuItems { get; set; }

Menu Items:

public class MenuItems : EntityModel
    public MenuLink menuItemDetails { get; set; }

    public List<EmbeddedModels.Columns> columns { get; set; }

MenuItemDetails is fine and we are able to fetch all the information related to it, the problem is with columns:

public class Columns : EntityModel

    public ContentSimple ContentSimple { get; set; }

    public Submenu Submenu { get; set; }

    public MediaItem mediaItem { get; set; }

    public ECLItem EclItems { get; set; }


ContentSimple does have another field for Media Item and EclItem I tried to write a class similar to the Teaser class and basically replaced columns class with that. But it stopped mapping the content completely.

  • It helps if you show how your View Model Types are defined. Commented Nov 1, 2018 at 6:51
  • added some additional information in the question now
    – GJin
    Commented Nov 1, 2018 at 18:18
  • Try using a single property of tyoe EntityModel instead of several properties of different types which map to the same CM field. Commented Nov 1, 2018 at 21:10

1 Answer 1


Without seeing your View Model Types, I can guess what this is about:

  • Your ECL Schema typically maps to a View Model Type which inherits from EclItem.
  • Your other two Schemas probably map to a common View Model Type or maybe to two different ones which inherit from a common base type.
  • The property to which the Component Link maps probably uses the latter type.

Such a setup is also called polymorphic mapping, because the actual instantiated type may be different from the type of the link property. To be precise: it may be a subclass of that type.

However, in your scenario, the first View Model Type (for the ECL item) is not a subclass of the type of the property. Hence, that View Model Type will not be considered for instantiation. If there is no mapping to another View Model Type which is a subclass, you will get the mentioned exception (indeed, method SemanticSchema.GetModelTypeFromSemanticMapping is used to determine an appropriate View Model Type to instantiate in case of polymorhpic mapping).

If you need such polymorphic mapping, you have to ensure that all target View Model Types inherit from a common base class and the type of the link property should be that common base class. In case you want to mix MM Components and regular Components, the common base class becomes EntityModel.

Alternatively, you can define a single View Model Type which maps to all target Schemas. See, for example, class Teaser in the Core Module.

  • We get that error even if i remove the ECLitem from our properties and only keep Mediaitem.
    – GJin
    Commented Nov 1, 2018 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.