We're new to Glass mapper and wanted to use it in our Sitecore project. When looking at the tutorials we noticed there were no deep examples of how to set up the deep inheritance that Sitecore allows. When browsing the web we noticed that there's people working with placing the attributes on the interfaces and on the other side there's people placing the attributes on the concrete classes. None of these examples explain their good reason for doing so however leaving us with the question: which is the correct use and what is the impact of doing one or the other?
Consider the following:
Template: Content (which is a field section template adding 2 simple fields: Title, Body) This template is directly and indirectly inherited by many of our templates.
Now in one of our sublayouts we use only this section and it is sort of a more general control thus we need to do: GetCurrentItem<Content>
or GetCurrentItem<IContent>
.
Personally I find the GetCurrentItem<IContent>
more intuitive as it feels like asking: "Give me the current item if it supports the content section" where the other feels more like "Give me the current item if it is a content section" (which technically is impossible since Content Items are never created)