We are new to Glass Mapper and would like to use it in our Sitecore project. When we looked at the lessons, we noticed that there were no deep examples of how to set up the deep inheritance that Sitecore allows. While browsing the web, we noticed that people who work with placing attributes on interfaces, and on the other hand, place attributes on specific classes there. None of these examples explains their good reasons for this, but leaves us with the question: which is the right use and what is the influence of one or the other?
Consider the following:
Template: Content (which is a field section template that adds 2 simple fields: Title, Body) This template is directly and indirectly inherited by many of our templates.
Now in one of our sublayers we use only this section, and this is rather more general control, so we need to do: GetCurrentItem<Content>or GetCurrentItem<IContent>.
Personally, I find it GetCurrentItem<IContent>more intuitive, as it seems to me that he asks: "Give me the current element if it supports the content section, where the other is more similar." Give me the current element if it is a content section "(which is technically impossible, since content elements are never created)
source
share