While trying to retrieve Content using dynamic component presentation, the KeywordModelData returns only the ID and other values are missing. For the field "name" as shown below. The same question exists for Java but i need a solution for .Net, is there any alternate model service code available to get complete KeywordModelData. Thanks in advance.
Content":{ "name":{"$type":"KeywordModelData","Id":"1455"}, "title":"Efficiency", "text":{"$type":"RichTextData","Fragments":["Rich Text Data from Comp"]}, "filterType":"CheckBox"}
private EntityModelData CreateEntityModelData(ComponentPresentation componentPresentation, Localization localization)
{
EntityModelData entityModelData = SiteConfiguration.ModelServiceProvider.GetEntityModelData(componentPresentation.ComponentId + "-" + componentPresentation.ComponentTemplateId, localization);
ContentModelData componentContent = entityModelData.Content;
ContentModelData componentMetadata = entityModelData.Metadata;
return new EntityModelData
{
Id = componentPresentation.ComponentId.ToString(),
SchemaId = entityModelData.SchemaId.ToString(),
Metadata = componentMetadata,
Content = componentContent
};
}
ModelServiceProvider
directly in application code; use theContentProvider
instead (it provides caching and semantic mapping functionality).