I am building a small POC website using the Tridion Reference Implementation.
In my site, i have a custom multimedia schema, where I define a number of metadata values for an image.
In my model, I defined a property for a Multimedia link to this schema
[SemanticProperty("s:product")]
public ProductImage Product { get; set; }
and my ProductImage class inherits from the Image class
public class ProductImage : Image
{
//define custom metadata properties here
}
Unfortunately, this doesn't seem to work out of the box. The TRI mapper class does map all the component fields to the appropriate model properties, but my Product property always gets a null value (when I change the class of product to Image, it does work.
I looked in the TRI source code, and searched for the DD4TModelBuilder class, which is responsible for mapping these component fields to my model properties. It looks like currently, this mapper only supports mapping multimedia link fields to models of type Image, Download or YouTubeVideo (which are included in the core module of the TRI).
I tried to extend the DD4TModelBuilder class, but the functions responsible for generating Image classes can't be overridden.
I'm wondering what my best option would be, should i create my own ModelBuilder class, copying all functionality from the DD4TModelBuilder, or is there another way (or am I doing something wrong) ?