Currently we are trying to access Schema Id's from within an entity in DXA and are unable to do so. How would we go about accomplishing this? Thanks
update:
We are actually trying to map Component fields that allow multiple Schemas. We use the SemanticProperty
to define multiple fields that map to just one field in the Schema.
We are finding that this is not working as expected. We were hoping to access the fields Schema ID or name to make sure we render out the Component link with the appropriate view.
Note: each of the allowed Schemas has their own view.
update 2:
public class Parent : EntityModel
{
public string id { get; set; }
[SemanticProperty("content")]
public List<SchemaA> contentA { get; set; }
[SemanticProperty("content")]
public List<SchemaB> contentB { get; set; }
}
SchemaA and SchemaB both have their own view implementation. Class Parent has a component link field called "content" that allows both SchemaA and SchemaB type components.
When accessing the collection contentB, we expected it to be populated only with SchemaB objects. But, both collections, contentA and contentB have the objects loaded (same object in both collections).
In order to render out the right collection with the right view, we would like to access the underlying schema to populate the right collection based on content.