4
this.ContentProvider.GetEntityModel("XXX" + "-" + "###", WebRequestContext.Localization);

Using the GetEntityModel i am reading the component based on different criteria now i need to read the metadata of a component created using embedded schema.I had no issue in reading the plan text filed by just created the property in the model got the value but for embedded values am facing this issue.I have created a separate model for embedded schema but no luck .

 [SemanticProperty("s:generalMeta")]
 Public GeneralMetadata generalMeta { get; set; }

[SemanticEntity(Vocab = SchemaOrgVocabulary, EntityName = "GeneralMetadata", Prefix = "md", Public = true)]
    public class GeneralMetadata : EntityModel
    {
        [SemanticProperty("md:publishDate")]
        public DateTime publishDate { get; set; }

        [SemanticProperty("md:shortTitle")]
        public string shortTitle { get; set; }
    }

Any help would be highly appreciated

2

There is a Known Issue with semantic mapping for embedded fields using explicit semantic mapping. Try using implicit mapping (without SemanticEntity or SemanticProperty attributes).

See, for example: https://github.com/sdl/dxa-web-application-dotnet/blob/release/1.5/Sdl.Web.Common/Models/Entity/Paragraph.cs

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.