Stop exposing mapper in MapperContext

This commit is contained in:
Stephan
2019-04-07 11:26:47 +02:00
parent 1af431a27d
commit 8049c40f90
13 changed files with 165 additions and 92 deletions

View File

@@ -65,7 +65,7 @@ namespace Umbraco.Web.Models.Mapping
private static void Map(IContent source, ContentPropertyCollectionDto target, MapperContext context)
{
// must pass the context through
target.Properties = source.Properties.Select(p => context.Mapper.Map<ContentPropertyDto>(p, context));
target.Properties = source.Properties.Select(context.Map<ContentPropertyDto>);
}
// Umbraco.Code.MapAll -AllowPreview -Errors -PersistedContent
@@ -76,7 +76,7 @@ namespace Umbraco.Web.Models.Mapping
target.ContentApps = _commonMapper.GetContentApps(source);
target.ContentTypeAlias = source.ContentType.Alias;
target.ContentTypeName = _localizedTextService.UmbracoDictionaryTranslate(source.ContentType.Name);
target.DocumentType = _commonMapper.GetContentType(source, context.Mapper);
target.DocumentType = _commonMapper.GetContentType(source, context);
target.Icon = source.ContentType.Icon;
target.Id = source.Id;
target.IsBlueprint = source.Blueprint;
@@ -84,7 +84,7 @@ namespace Umbraco.Web.Models.Mapping
target.IsContainer = source.ContentType.IsContainer;
target.IsElement = source.ContentType.IsElement;
target.Key = source.Key;
target.Owner = _commonMapper.GetOwner(source, context.Mapper);
target.Owner = _commonMapper.GetOwner(source, context);
target.ParentId = source.ParentId;
target.Path = source.Path;
target.SortOrder = source.SortOrder;
@@ -94,12 +94,12 @@ namespace Umbraco.Web.Models.Mapping
target.TreeNodeUrl = _commonMapper.GetTreeNodeUrl<ContentTreeController>(source);
target.Udi = Udi.Create(source.Blueprint ? Constants.UdiEntityType.DocumentBlueprint : Constants.UdiEntityType.Document, source.Key);
target.UpdateDate = source.UpdateDate;
target.Updater = _commonMapper.GetCreator(source, context.Mapper);
target.Updater = _commonMapper.GetCreator(source, context);
target.Urls = GetUrls(source);
target.Variants = _contentVariantMapper.Map(source, context);
target.ContentDto = new ContentPropertyCollectionDto();
target.ContentDto.Properties = source.Properties.Select(context.Mapper.Map<ContentPropertyDto>);
target.ContentDto.Properties = source.Properties.Select(context.Map<ContentPropertyDto>);
}
// Umbraco.Code.MapAll -Segment -Language
@@ -125,17 +125,17 @@ namespace Umbraco.Web.Models.Mapping
target.Id = source.Id;
target.Key = source.Key;
target.Name = GetName(source, context);
target.Owner = _commonMapper.GetOwner(source, context.Mapper);
target.Owner = _commonMapper.GetOwner(source, context);
target.ParentId = source.ParentId;
target.Path = source.Path;
// must pass the context through
target.Properties = source.Properties.Select(p => context.Mapper.Map<ContentPropertyBasic>(p, context));
target.Properties = source.Properties.Select(context.Map<ContentPropertyBasic>);
target.SortOrder = source.SortOrder;
target.State = _basicStateMapper.Map(source, context);
target.Trashed = source.Trashed;
target.Udi = Udi.Create(source.Blueprint ? Constants.UdiEntityType.DocumentBlueprint : Constants.UdiEntityType.Document, source.Key);
target.UpdateDate = GetUpdateDate(source, context);
target.Updater = _commonMapper.GetCreator(source, context.Mapper);
target.Updater = _commonMapper.GetCreator(source, context);
target.VariesByCulture = source.ContentType.VariesByCulture();
}