3

I want to retrieve images dynamically from the Broker which are published as dynamic multimedia Components.

I am not sure about the model, I have tried to repeat the same way the default image model is created by but no luck not getting the image object although metadata is available.

Update

MediaCentreImage is the name of the Schema which we have created.

[SemanticEntity(SchemaOrgVocabulary, "ImageObject", Prefix = "s", Public = true)]
[SemanticEntity(CoreVocabulary, "MediaCentreImage", Prefix = "c")]
public class MediaImage : MediaItem
{ }
  • Can you clarify what you want to achieve and what you have tried? – Rick Pannekoek Aug 26 '16 at 15:30
  • @RickPannekoek As i mentioned i need to retrieve/display images based on parameters selected by end user like size,location etc. for that we have created new media schema we got the metadata details but image object is not available .i tried to repeat with the default image model available in DXA but image property is returning as null I have created new model name MediaImage which is inheriting the MediaItem.model like in Image model – Hem Kant Aug 26 '16 at 15:37
  • Please show the definition of your View Model. – Rick Pannekoek Aug 27 '16 at 9:35
  • @RickPannekoek Here MediaCentreImage is the name of the schema which we have created. [SemanticEntity(SchemaOrgVocabulary, "ImageObject", Prefix = "s", Public = true)] [SemanticEntity(CoreVocabulary, "MediaCentreImage", Prefix = "c")] public class MediaImage : MediaItem { } – Hem Kant Aug 28 '16 at 16:56
  • is this a multimedia schema or your image is part of content schema? – Raj Kumar Aug 29 '16 at 8:32
2

Make sure you have created a default view for the Model, which uses and returns object based on the same. Add any metadata that you have in your schema, add to the model class itself. Once done, try using your model class object, in another model which has a link to a component based on your multimedia schema. For example, instead of:

 [SemanticProperty("s:image")]
 public Image Image { get; set; }

use:

 [SemanticProperty("s:image")]
 public MediaCentreImage Image { get; set; }
  • I'm impressed that you managed to distill this answer from the question! The question is still prett unclear to me, but looking at this (accepted) answer, it seems the question was how to get an embedded Entity Model mapped properly? – Rick Pannekoek Aug 30 '16 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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