We are mapping multiple Schemas to a single Entity and furthermore we are using the same entity view. Therefore, we would like to know the type of the entity (rootElement schema) in the entity view, is it possible? We have implemented a work around adding an extrafield in our components, but we're wondering if this is already done by DXA.

For example, following the documentation example, how is possible to know if we have an article or an event, if both are mapped to the Teaser class.

  • Is the use case rendering each type of content differently in the view's logic? Is the Schema name available as an alternative? Commented Oct 8, 2015 at 19:24
  • 1
    If you want to render differently, you should use different Views. Commented Oct 8, 2015 at 19:49
  • Each type of content is rendered differently in the same view, but we don't have the schema name. We implemented a workaround, adding a field in the schema indicating the name of the schema itself
    – tfinez
    Commented Oct 9, 2015 at 7:27

2 Answers 2


If you are mapping to the same View Model and using the same View, there is no way to distinguish anymore.


As Rick mentions, from the view model you cannot distinguish anymore, which is the whole idea of using view models.

If you have a need to render differently, you should consider using different views, rather than conditional statements in a single view as that becomes messy and views should be clean and straight forward.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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