I have a series of Infographic Items being added to a Infographic Container. The Infographic Container Model is as follows and works just fine:
namespace MyNamespace
{
[SitecoreType(AutoMap = true)]
public class InfographicContainerViewModel : BaseTemplateViewModel
{
public virtual string InfographicTitle { get; set; }
public virtual string Description { get; set; }
}
}
For my Infographic Item Model I've done essentially the same thing, but the fields are always mapping to null. Stepping through the debugger, I can see that the item itself is being mapped to correctly (Correct IDs, name, ect.) and the item is in the correct language. My first ideas were to add in the Template ID to the SitecoreType attribute and place the names of the fields in the SitecoreField attributes, but neither resulted in a correct mapping. Here is my Infographic Item Model as it stands now:
namespace MyNamespace {
[SitecoreType(TemplateId = "{5E6DF63A-0327-4587-8E72-AB35A7184200}", AutoMap = true)]
public class InfographicItemViewModel : BaseTemplateViewModel
{
[SitecoreField("ItemTitle")]
public virtual string ItemTitle { get; set; }
[SitecoreField("ExpandedTitle")]
public virtual string ExpandedTitle { get; set; }
[SitecoreField("ExpandedDescription")]
public virtual string ExpandedDescription { get; set; }
}
}
Here is a screenshot of the debugger where you can see the fields mapping to null:
And here is a screenshot of the template as it exists in Sitecore: