More manual merging

This commit is contained in:
Shannon
2019-06-28 15:03:52 +10:00
parent 568835f7e2
commit 4a33ca99ba
13 changed files with 153 additions and 38 deletions

View File

@@ -16,15 +16,17 @@ namespace Umbraco.Web.Models.Mapping
internal class ContentPropertyBasicMapper<TDestination>
where TDestination : ContentPropertyBasic, new()
{
private readonly IEntityService _entityService;
private readonly ILogger _logger;
private readonly PropertyEditorCollection _propertyEditors;
protected IDataTypeService DataTypeService { get; }
public ContentPropertyBasicMapper(IDataTypeService dataTypeService, ILogger logger, PropertyEditorCollection propertyEditors)
public ContentPropertyBasicMapper(IDataTypeService dataTypeService, IEntityService entityService, ILogger logger, PropertyEditorCollection propertyEditors)
{
_logger = logger;
_propertyEditors = propertyEditors;
DataTypeService = dataTypeService;
_entityService = entityService;
}
/// <summary>
@@ -49,6 +51,11 @@ namespace Umbraco.Web.Models.Mapping
dest.PropertyEditor = editor;
dest.Editor = editor.Alias;
var dataTypeKey = _entityService.GetKey(property.PropertyType.DataTypeId, UmbracoObjectTypes.DataType);
if (!dataTypeKey.Success)
throw new InvalidOperationException("Can't get the unique key from the id: " + property.PropertyType.DataTypeId);
dest.DataTypeId = dataTypeKey.Result;
// if there's a set of property aliases specified, we will check if the current property's value should be mapped.
// if it isn't one of the ones specified in 'includeProperties', we will just return the result without mapping the Value.
var includedProperties = context.GetIncludedProperties();