Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Hackathon - SitecoreFieldMapper
namespace DevToolKit.EntityMapping
public class SitecoreFieldMapper : ISitecoreFieldMapper
public FieldModel MapToEntity(Field field)
Assert.IsNotNull(field, "field can not be null");
var baseTemplate = TemplateManager.GetTemplate(
Assert.IsNotNull(baseTemplate, "template can not be null");
var template = field.GetTemplateField().Template;
var entity = new FieldModel
Id = field.ID.ToString(),
Name = field.Name,
Value = field.Value,
StandardValue = field.GetStandardValue(),
TemplateName = template.Name,
TemplateId = template.ID.ToString(),
StandardField = baseTemplate.ContainsField(field.ID),
SortOrder = field.Sortorder,
SectionSortOrder = field.SectionSortorder,
return entity;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment