Cleanup and fix mappers

This commit is contained in:
Stephan
2019-03-26 18:47:35 +01:00
parent 70c2090a56
commit 72bdf56ddf
23 changed files with 451 additions and 647 deletions

View File

@@ -105,14 +105,8 @@ namespace Umbraco.Web.Models.Mapping
/// <returns></returns>
protected virtual List<ContentPropertyDisplay> MapProperties(IContentBase content, List<Property> properties, MapperContext context)
{
//we need to map this way to pass the context through, I don't like it but we'll see what AutoMapper says: https://github.com/AutoMapper/AutoMapper/issues/2588
var result = context.Mapper.Map<IEnumerable<Property>, IEnumerable<ContentPropertyDisplay>>(
properties.OrderBy(prop => prop.PropertyType.SortOrder),
null,
context)
.ToList();
return result;
// must pass the context through
return properties.OrderBy(x => x.PropertyType.SortOrder).Select(x => context.Mapper.Map<ContentPropertyDisplay>(x, context)).ToList();
}
}