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 ComponentComponents, 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.