diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/CoreMappingProfiles.cs b/src/Umbraco.Core/Composing/CompositionExtensions/CoreMappingProfiles.cs index 68a19a013b..165fa10be7 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/CoreMappingProfiles.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/CoreMappingProfiles.cs @@ -8,9 +8,9 @@ namespace Umbraco.Core.Composing.CompositionExtensions { public static Composition ComposeCoreMappingProfiles(this Composition composition) { - composition.RegisterUnique(); - composition.WithCollectionBuilder() - .Add(); + composition.RegisterUnique(); + composition.WithCollectionBuilder() + .Add(); return composition; } } diff --git a/src/Umbraco.Core/Composing/Current.cs b/src/Umbraco.Core/Composing/Current.cs index 1b39429494..f12bf0dd63 100644 --- a/src/Umbraco.Core/Composing/Current.cs +++ b/src/Umbraco.Core/Composing/Current.cs @@ -104,8 +104,8 @@ namespace Umbraco.Core.Composing #region Getters - public static Mapper Mapper - => _factory.GetInstance(); + public static UmbracoMapper Mapper + => _factory.GetInstance(); public static IShortStringHelper ShortStringHelper => _shortStringHelper ?? (_shortStringHelper = _factory?.TryGetInstance() diff --git a/src/Umbraco.Core/Mapping/IMapperProfile.cs b/src/Umbraco.Core/Mapping/IMapDefinition.cs similarity index 53% rename from src/Umbraco.Core/Mapping/IMapperProfile.cs rename to src/Umbraco.Core/Mapping/IMapDefinition.cs index 9d0c412c68..ffea07c3eb 100644 --- a/src/Umbraco.Core/Mapping/IMapperProfile.cs +++ b/src/Umbraco.Core/Mapping/IMapDefinition.cs @@ -1,13 +1,13 @@ namespace Umbraco.Core.Mapping { /// - /// Represents a mapper profile. + /// Defines maps for . /// - public interface IMapperProfile + public interface IMapDefinition { /// /// Defines maps. /// - void DefineMaps(Mapper mapper); + void DefineMaps(UmbracoMapper mapper); } } diff --git a/src/Umbraco.Core/Mapping/MapDefinitionCollection.cs b/src/Umbraco.Core/Mapping/MapDefinitionCollection.cs new file mode 100644 index 0000000000..e2438515f0 --- /dev/null +++ b/src/Umbraco.Core/Mapping/MapDefinitionCollection.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using Umbraco.Core.Composing; + +namespace Umbraco.Core.Mapping +{ + public class MapDefinitionCollection : BuilderCollectionBase + { + public MapDefinitionCollection(IEnumerable items) + : base(items) + { } + } +} diff --git a/src/Umbraco.Core/Mapping/MapDefinitionCollectionBuilder.cs b/src/Umbraco.Core/Mapping/MapDefinitionCollectionBuilder.cs new file mode 100644 index 0000000000..15d94e58a0 --- /dev/null +++ b/src/Umbraco.Core/Mapping/MapDefinitionCollectionBuilder.cs @@ -0,0 +1,11 @@ +using Umbraco.Core.Composing; + +namespace Umbraco.Core.Mapping +{ + public class MapDefinitionCollectionBuilder : SetCollectionBuilderBase + { + protected override MapDefinitionCollectionBuilder This => this; + + protected override Lifetime CollectionLifetime => Lifetime.Transient; + } +} diff --git a/src/Umbraco.Core/Mapping/MapperContext.cs b/src/Umbraco.Core/Mapping/MapperContext.cs index 5f78fc6893..9e385b32a8 100644 --- a/src/Umbraco.Core/Mapping/MapperContext.cs +++ b/src/Umbraco.Core/Mapping/MapperContext.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Mapping /// /// Initializes a new instance of the class. /// - public MapperContext(Mapper mapper) + public MapperContext(UmbracoMapper mapper) { Mapper = mapper; } @@ -20,7 +20,7 @@ namespace Umbraco.Core.Mapping /// /// Gets the mapper. /// - public Mapper Mapper { get;} + public UmbracoMapper Mapper { get;} /// /// Gets a value indicating whether the context has items. diff --git a/src/Umbraco.Core/Mapping/MapperProfileCollection.cs b/src/Umbraco.Core/Mapping/MapperProfileCollection.cs deleted file mode 100644 index 692f96fcc7..0000000000 --- a/src/Umbraco.Core/Mapping/MapperProfileCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.Composing; - -namespace Umbraco.Core.Mapping -{ - public class MapperProfileCollection : BuilderCollectionBase - { - public MapperProfileCollection(IEnumerable items) - : base(items) - { } - } -} diff --git a/src/Umbraco.Core/Mapping/MapperProfileCollectionBuilder.cs b/src/Umbraco.Core/Mapping/MapperProfileCollectionBuilder.cs deleted file mode 100644 index 2bf7f5a5d8..0000000000 --- a/src/Umbraco.Core/Mapping/MapperProfileCollectionBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Umbraco.Core.Composing; - -namespace Umbraco.Core.Mapping -{ - public class MapperProfileCollectionBuilder : SetCollectionBuilderBase - { - protected override MapperProfileCollectionBuilder This => this; - - protected override Lifetime CollectionLifetime => Lifetime.Transient; - } -} diff --git a/src/Umbraco.Core/Mapping/Mapper.cs b/src/Umbraco.Core/Mapping/UmbracoMapper.cs similarity index 98% rename from src/Umbraco.Core/Mapping/Mapper.cs rename to src/Umbraco.Core/Mapping/UmbracoMapper.cs index 8fcfd2ca11..e7f754f0a6 100644 --- a/src/Umbraco.Core/Mapping/Mapper.cs +++ b/src/Umbraco.Core/Mapping/UmbracoMapper.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Mapping /// /// Umbraco Mapper. /// - public class Mapper + public class UmbracoMapper { private readonly Dictionary>> _ctors = new Dictionary>>(); @@ -20,10 +20,10 @@ namespace Umbraco.Core.Mapping = new Dictionary>>(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - public Mapper(MapperProfileCollection profiles) + public UmbracoMapper(MapDefinitionCollection profiles) { foreach (var profile in profiles) profile.DefineMaps(this); diff --git a/src/Umbraco.Core/Models/Identity/IdentityMapperProfile.cs b/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs similarity index 95% rename from src/Umbraco.Core/Models/Identity/IdentityMapperProfile.cs rename to src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs index 04937bf55a..57e1c9ee5c 100644 --- a/src/Umbraco.Core/Models/Identity/IdentityMapperProfile.cs +++ b/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs @@ -6,20 +6,20 @@ using Umbraco.Core.Services; namespace Umbraco.Core.Models.Identity { - public class IdentityMapperProfile : IMapperProfile + public class IdentityMapDefinition : IMapDefinition { private readonly ILocalizedTextService _textService; private readonly IEntityService _entityService; private readonly IGlobalSettings _globalSettings; - public IdentityMapperProfile(ILocalizedTextService textService, IEntityService entityService, IGlobalSettings globalSettings) + public IdentityMapDefinition(ILocalizedTextService textService, IEntityService entityService, IGlobalSettings globalSettings) { _textService = textService; _entityService = entityService; _globalSettings = globalSettings; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define( (source, context) => diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs index cf50bcf033..085a7b7a5b 100644 --- a/src/Umbraco.Core/Security/BackOfficeUserStore.cs +++ b/src/Umbraco.Core/Security/BackOfficeUserStore.cs @@ -7,12 +7,12 @@ using System.Web.Security; using Microsoft.AspNet.Identity; using Umbraco.Core.Configuration; using Umbraco.Core.Exceptions; +using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Models.Identity; using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using IUser = Umbraco.Core.Models.Membership.IUser; -using Mapper = Umbraco.Core.Mapping.Mapper; using Task = System.Threading.Tasks.Task; namespace Umbraco.Core.Security @@ -38,10 +38,10 @@ namespace Umbraco.Core.Security private readonly IEntityService _entityService; private readonly IExternalLoginService _externalLoginService; private readonly IGlobalSettings _globalSettings; - private readonly Mapper _mapper; + private readonly UmbracoMapper _mapper; private bool _disposed = false; - public BackOfficeUserStore(IUserService userService, IMemberTypeService memberTypeService, IEntityService entityService, IExternalLoginService externalLoginService, IGlobalSettings globalSettings, MembershipProviderBase usersMembershipProvider, Mapper mapper) + public BackOfficeUserStore(IUserService userService, IMemberTypeService memberTypeService, IEntityService entityService, IExternalLoginService externalLoginService, IGlobalSettings globalSettings, MembershipProviderBase usersMembershipProvider, UmbracoMapper mapper) { _userService = userService; _memberTypeService = memberTypeService; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 8f8e67a796..30c3165183 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -215,10 +215,10 @@ - - - - + + + + @@ -448,7 +448,7 @@ - + diff --git a/src/Umbraco.Tests/Mapping/MappingTests.cs b/src/Umbraco.Tests/Mapping/MappingTests.cs index ef19411537..5cfb0056b5 100644 --- a/src/Umbraco.Tests/Mapping/MappingTests.cs +++ b/src/Umbraco.Tests/Mapping/MappingTests.cs @@ -11,11 +11,11 @@ namespace Umbraco.Tests.Mapping [Test] public void SimpleMap() { - var profiles = new MapperProfileCollection(new IMapperProfile[] + var profiles = new MapDefinitionCollection(new IMapDefinition[] { new Profile1(), }); - var mapper = new Mapper(profiles); + var mapper = new UmbracoMapper(profiles); var thing1 = new Thing1 { Value = "value" }; var thing2 = mapper.Map(thing1); @@ -36,11 +36,11 @@ namespace Umbraco.Tests.Mapping [Test] public void EnumerableMap() { - var profiles = new MapperProfileCollection(new IMapperProfile[] + var profiles = new MapDefinitionCollection(new IMapDefinition[] { new Profile1(), }); - var mapper = new Mapper(profiles); + var mapper = new UmbracoMapper(profiles); var thing1A = new Thing1 { Value = "valueA" }; var thing1B = new Thing1 { Value = "valueB" }; @@ -58,21 +58,16 @@ namespace Umbraco.Tests.Mapping Assert.AreEqual(2, thing2.Count); Assert.AreEqual("valueA", thing2[0].Value); Assert.AreEqual("valueB", thing2[1].Value); - - // fixme is this a thing? - //thing2 = new List(); - //mapper.Map(thing1, thing2); - //Assert.AreEqual("value", thing2.Value); } [Test] public void InheritedMap() { - var profiles = new MapperProfileCollection(new IMapperProfile[] + var profiles = new MapDefinitionCollection(new IMapDefinition[] { new Profile1(), }); - var mapper = new Mapper(profiles); + var mapper = new UmbracoMapper(profiles); var thing3 = new Thing3 { Value = "value" }; var thing2 = mapper.Map(thing3); @@ -103,9 +98,9 @@ namespace Umbraco.Tests.Mapping public string Value { get; set; } } - private class Profile1 : IMapperProfile + private class Profile1 : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new Thing2(), Map); } diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 97588bb26f..316feb578e 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -108,7 +108,7 @@ namespace Umbraco.Tests.Testing protected IMapperCollection Mappers => Factory.GetInstance(); - protected Mapper Mapper => Factory.GetInstance(); + protected UmbracoMapper Mapper => Factory.GetInstance(); #endregion diff --git a/src/Umbraco.Web/Composing/CompositionExtensions/WebMappingProfiles.cs b/src/Umbraco.Web/Composing/CompositionExtensions/WebMappingProfiles.cs index b90b7b4f6a..55790a695a 100644 --- a/src/Umbraco.Web/Composing/CompositionExtensions/WebMappingProfiles.cs +++ b/src/Umbraco.Web/Composing/CompositionExtensions/WebMappingProfiles.cs @@ -9,25 +9,25 @@ namespace Umbraco.Web.Composing.CompositionExtensions { public static Composition ComposeWebMappingProfiles(this Composition composition) { - composition.WithCollectionBuilder() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add() - .Add(); + composition.WithCollectionBuilder() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add(); composition.Register(); diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs index 8d6066a841..420c0b8a4c 100644 --- a/src/Umbraco.Web/Composing/Current.cs +++ b/src/Umbraco.Web/Composing/Current.cs @@ -165,7 +165,7 @@ namespace Umbraco.Web.Composing // proxy Core for convenience - public static Mapper Mapper => CoreCurrent.Mapper; + public static UmbracoMapper Mapper => CoreCurrent.Mapper; public static IRuntimeState RuntimeState => CoreCurrent.RuntimeState; diff --git a/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs b/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs index d91114c816..1bd7f766d4 100644 --- a/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Editors.Filters _userService = userService; } - private static Mapper Mapper => Current.Mapper; + private static UmbracoMapper Mapper => Current.Mapper; private IUserService UserService => _userService ?? Current.Services.UserService; // TODO: inject diff --git a/src/Umbraco.Web/Models/Mapping/AuditMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/AuditMapDefinition.cs similarity index 87% rename from src/Umbraco.Web/Models/Mapping/AuditMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/AuditMapDefinition.cs index ac540b1bce..9bc0229550 100644 --- a/src/Umbraco.Web/Models/Mapping/AuditMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/AuditMapDefinition.cs @@ -4,9 +4,9 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class AuditMapperProfile : IMapperProfile + internal class AuditMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new AuditLog(), Map); } diff --git a/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/CodeFileMapDefinition.cs similarity index 96% rename from src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/CodeFileMapDefinition.cs index d26422fc90..6af9d9149e 100644 --- a/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/CodeFileMapDefinition.cs @@ -5,9 +5,9 @@ using Stylesheet = Umbraco.Core.Models.Stylesheet; namespace Umbraco.Web.Models.Mapping { - public class CodeFileMapperProfile : IMapperProfile + public class CodeFileMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new EntityBasic(), Map); mapper.Define((source, context) => new CodeFileDisplay(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs index fab12494ff..985cc2d628 100644 --- a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs @@ -34,19 +34,19 @@ namespace Umbraco.Web.Models.Mapping _localizedTextService = localizedTextService; } - public UserProfile GetOwner(IContentBase source, Mapper mapper) + public UserProfile GetOwner(IContentBase source, UmbracoMapper mapper) { var profile = source.GetCreatorProfile(_userService); return profile == null ? null : mapper.Map(profile); } - public UserProfile GetCreator(IContent source, Mapper mapper) + public UserProfile GetCreator(IContent source, UmbracoMapper mapper) { var profile = source.GetWriterProfile(_userService); return profile == null ? null : mapper.Map(profile); } - public ContentTypeBasic GetContentType(IContentBase source, Mapper mapper) + public ContentTypeBasic GetContentType(IContentBase source, UmbracoMapper mapper) { // TODO: We can resolve the UmbracoContext from the IValueResolver options! // OMG diff --git a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs index 8ee8bc9f4b..c62fa387c0 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Declares how model mappings for content /// - internal class ContentMapperProfile : IMapperProfile + internal class ContentMapDefinition : IMapDefinition { private readonly CommonMapper _commonMapper; private readonly ILocalizedTextService _localizedTextService; @@ -32,7 +32,7 @@ namespace Umbraco.Web.Models.Mapping private readonly ContentBasicSavedStateMapper _basicStateMapper; private readonly ContentVariantMapper _contentVariantMapper; - public ContentMapperProfile(CommonMapper commonMapper, ILocalizedTextService localizedTextService, IContentService contentService, IContentTypeService contentTypeService, + public ContentMapDefinition(CommonMapper commonMapper, ILocalizedTextService localizedTextService, IContentService contentService, IContentTypeService contentTypeService, IFileService fileService, IUmbracoContextAccessor umbracoContextAccessor, IPublishedRouter publishedRouter, ILocalizationService localizationService, ILogger logger, IUserService userService) { @@ -53,7 +53,7 @@ namespace Umbraco.Web.Models.Mapping _contentVariantMapper = new ContentVariantMapper(_localizationService); } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new ContentPropertyCollectionDto(), Map); mapper.Define((source, context) => new ContentItemDisplay(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs similarity index 93% rename from src/Umbraco.Web/Models/Mapping/ContentPropertyMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs index 2a032fb47a..226560c516 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs @@ -11,20 +11,20 @@ namespace Umbraco.Web.Models.Mapping /// A mapper which declares how to map content properties. These mappings are shared among media (and probably members) which is /// why they are in their own mapper /// - internal class ContentPropertyMapperProfile : IMapperProfile + internal class ContentPropertyMapDefinition : IMapDefinition { private readonly ContentPropertyBasicMapper _contentPropertyBasicConverter; private readonly ContentPropertyDtoMapper _contentPropertyDtoConverter; private readonly ContentPropertyDisplayMapper _contentPropertyDisplayMapper; - public ContentPropertyMapperProfile(IDataTypeService dataTypeService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors) + public ContentPropertyMapDefinition(IDataTypeService dataTypeService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors) { _contentPropertyBasicConverter = new ContentPropertyBasicMapper(dataTypeService, logger, propertyEditors); _contentPropertyDtoConverter = new ContentPropertyDtoMapper(dataTypeService, logger, propertyEditors); _contentPropertyDisplayMapper = new ContentPropertyDisplayMapper(dataTypeService, textService, logger, propertyEditors); } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define>((source, context) => new Tab(), Map); mapper.Define((source, context) => new ContentPropertyBasic(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs index e0ca7aeaee..3d4ed5350e 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Defines mappings for content/media/members type mappings /// - internal class ContentTypeMapperProfile : IMapperProfile + internal class ContentTypeMapDefinition : IMapDefinition { private readonly PropertyEditorCollection _propertyEditors; private readonly IDataTypeService _dataTypeService; @@ -24,7 +24,7 @@ namespace Umbraco.Web.Models.Mapping private readonly IMemberTypeService _memberTypeService; private readonly ILogger _logger; - public ContentTypeMapperProfile(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IFileService fileService, + public ContentTypeMapDefinition(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IFileService fileService, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, ILogger logger) { @@ -37,7 +37,7 @@ namespace Umbraco.Web.Models.Mapping _logger = logger; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new ContentType(source.ParentId), Map); mapper.Define((source, context) => new MediaType(source.ParentId), Map); @@ -358,7 +358,7 @@ namespace Umbraco.Web.Models.Mapping // Umbraco.Code.MapAll -CreatorId -Level -SortOrder // Umbraco.Code.MapAll -CreateDate -UpdateDate -DeleteDate // Umbraco.Code.MapAll -ContentTypeComposition (done by AfterMapSaveToType) - private static void MapSaveToTypeBase(TSource source, IContentTypeComposition target, Mapper mapper) + private static void MapSaveToTypeBase(TSource source, IContentTypeComposition target, UmbracoMapper mapper) where TSource : ContentTypeSave where TSourcePropertyType : PropertyTypeBasic { @@ -517,7 +517,7 @@ namespace Umbraco.Web.Models.Mapping } // no MapAll - relies on the non-generic method - private void MapTypeToDisplayBase(TSource source, TTarget target, Mapper mapper) + private void MapTypeToDisplayBase(TSource source, TTarget target, UmbracoMapper mapper) where TSource : ContentTypeSave where TSourcePropertyType : PropertyTypeBasic where TTarget : ContentTypeCompositionDisplay @@ -574,7 +574,7 @@ namespace Umbraco.Web.Models.Mapping return Udi.Create(udiType, source.Key); } - private static PropertyGroup MapSaveGroup(PropertyGroupBasic sourceGroup, IEnumerable destOrigGroups, Mapper mapper) + private static PropertyGroup MapSaveGroup(PropertyGroupBasic sourceGroup, IEnumerable destOrigGroups, UmbracoMapper mapper) where TPropertyType : PropertyTypeBasic { PropertyGroup destGroup; @@ -600,7 +600,7 @@ namespace Umbraco.Web.Models.Mapping return destGroup; } - private static PropertyType MapSaveProperty(PropertyTypeBasic sourceProperty, IEnumerable destOrigProperties, Mapper mapper) + private static PropertyType MapSaveProperty(PropertyTypeBasic sourceProperty, IEnumerable destOrigProperties, UmbracoMapper mapper) { PropertyType destProperty; if (sourceProperty.Id > 0) diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs similarity index 95% rename from src/Umbraco.Web/Models/Mapping/DataTypeMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs index 6bf48f520e..aafa5cb4d2 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs @@ -11,12 +11,12 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class DataTypeMapperProfile : IMapperProfile + internal class DataTypeMapDefinition : IMapDefinition { private readonly PropertyEditorCollection _propertyEditors; private readonly ILogger _logger; - public DataTypeMapperProfile(PropertyEditorCollection propertyEditors, ILogger logger) + public DataTypeMapDefinition(PropertyEditorCollection propertyEditors, ILogger logger) { _propertyEditors = propertyEditors; _logger = logger; @@ -29,7 +29,7 @@ namespace Umbraco.Web.Models.Mapping Constants.DataTypes.DefaultMembersListView }; - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new PropertyEditorBasic(), Map); mapper.Define((source, context) => new DataTypeConfigurationFieldDisplay(), Map); @@ -124,7 +124,7 @@ namespace Umbraco.Web.Models.Mapping target.ParentId = source.ParentId; } - private IEnumerable MapAvailableEditors(IDataType source, Mapper mapper) + private IEnumerable MapAvailableEditors(IDataType source, UmbracoMapper mapper) { var contentSection = Current.Configs.Settings().Content; return _propertyEditors @@ -133,7 +133,7 @@ namespace Umbraco.Web.Models.Mapping .Select(mapper.Map); } - private IEnumerable MapPreValues(IDataType dataType, Mapper mapper) + private IEnumerable MapPreValues(IDataType dataType, UmbracoMapper mapper) { // in v7 it was apparently fine to have an empty .EditorAlias here, in which case we would map onto // an empty fields list, which made no sense since there would be nothing to map to - and besides, @@ -166,7 +166,7 @@ namespace Umbraco.Web.Models.Mapping else { // weird - just leave the field without a value - but warn - _logger.Warn("Could not find a value for configuration field '{ConfigField}'", field.Key); + _logger.Warn("Could not find a value for configuration field '{ConfigField}'", field.Key); } } } @@ -181,7 +181,7 @@ namespace Umbraco.Web.Models.Mapping return ValueTypes.ToStorageType(valueType); } - private IEnumerable MapPreValues(IDataEditor source, Mapper mapper) + private IEnumerable MapPreValues(IDataEditor source, UmbracoMapper mapper) { // this is a new data type, initialize default configuration // get the configuration editor, diff --git a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/DictionaryMapDefinition.cs similarity index 96% rename from src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/DictionaryMapDefinition.cs index ed520da513..c7ae0cb717 100644 --- a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/DictionaryMapDefinition.cs @@ -13,16 +13,16 @@ namespace Umbraco.Web.Models.Mapping /// /// The dictionary model mapper. /// - internal class DictionaryMapperProfile : IMapperProfile + internal class DictionaryMapDefinition : IMapDefinition { private readonly ILocalizationService _localizationService; - public DictionaryMapperProfile(ILocalizationService localizationService) + public DictionaryMapDefinition(ILocalizationService localizationService) { _localizationService = localizationService; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new EntityBasic(), Map); mapper.Define((source, context) => new DictionaryDisplay(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs index 0d75f76a9d..fe9cc622ce 100644 --- a/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs @@ -13,9 +13,9 @@ using Umbraco.Examine; namespace Umbraco.Web.Models.Mapping { - internal class EntityMapperProfile : IMapperProfile + internal class EntityMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new EntityBasic(), Map); mapper.Define((source, context) => new EntityBasic(), Map); @@ -114,7 +114,7 @@ namespace Umbraco.Web.Models.Mapping target.Name = source.Name; target.ParentId = source.ParentId; target.Path = source.Path; - target.Udi = ContentTypeMapperProfile.MapContentTypeUdi(source); + target.Udi = ContentTypeMapDefinition.MapContentTypeUdi(source); } // Umbraco.Code.MapAll -Trashed -Alias -Score diff --git a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/LanguageMapDefinition.cs similarity index 91% rename from src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/LanguageMapDefinition.cs index f9de5ab0f9..dcdd737676 100644 --- a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/LanguageMapDefinition.cs @@ -8,9 +8,9 @@ using Language = Umbraco.Web.Models.ContentEditing.Language; namespace Umbraco.Web.Models.Mapping { - internal class LanguageMapperProfile : IMapperProfile + internal class LanguageMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new EntityBasic(), Map); mapper.Define((source, context) => new Language(), Map); @@ -40,6 +40,8 @@ namespace Umbraco.Web.Models.Mapping private static void Map(IEnumerable source, IEnumerable target, MapperContext context) { + if (target == null) + throw new ArgumentNullException(nameof(target)); if (!(target is List list)) throw new NotSupportedException($"{nameof(target)} must be a List."); diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs similarity index 92% rename from src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs index 9d2b59b2f1..b3cd662315 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs @@ -9,18 +9,18 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class MacroMapperProfile : IMapperProfile + internal class MacroMapDefinition : IMapDefinition { private readonly ParameterEditorCollection _parameterEditors; private readonly ILogger _logger; - public MacroMapperProfile(ParameterEditorCollection parameterEditors, ILogger logger) + public MacroMapDefinition(ParameterEditorCollection parameterEditors, ILogger logger) { _parameterEditors = parameterEditors; _logger = logger; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new EntityBasic(), Map); mapper.Define>((source, context) => source.Properties.Values.Select(context.Mapper.Map).ToList()); @@ -54,7 +54,7 @@ namespace Umbraco.Web.Models.Mapping { //we'll just map this to a text box paramEditor = _parameterEditors[Constants.PropertyEditors.Aliases.TextBox]; - _logger.Warn("Could not resolve a parameter editor with alias {PropertyEditorAlias}, a textbox will be rendered in it's place", source.EditorAlias); + _logger.Warn("Could not resolve a parameter editor with alias {PropertyEditorAlias}, a textbox will be rendered in it's place", source.EditorAlias); } target.View = paramEditor.GetValueEditor().View; diff --git a/src/Umbraco.Web/Models/Mapping/MediaMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs similarity index 96% rename from src/Umbraco.Web/Models/Mapping/MediaMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs index 80f8a3b61e..b1d5955368 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Models.Mapping /// /// Declares model mappings for media. /// - internal class MediaMapperProfile : IMapperProfile + internal class MediaMapDefinition : IMapDefinition { private readonly CommonMapper _commonMapper; private readonly ILogger _logger; @@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.Mapping private readonly IMediaTypeService _mediaTypeService; private readonly TabsAndPropertiesMapper _tabsAndPropertiesMapper; - public MediaMapperProfile(ILogger logger, CommonMapper commonMapper, IMediaService mediaService, IMediaTypeService mediaTypeService, + public MediaMapDefinition(ILogger logger, CommonMapper commonMapper, IMediaService mediaService, IMediaTypeService mediaTypeService, ILocalizedTextService localizedTextService) { _logger = logger; @@ -32,7 +32,7 @@ namespace Umbraco.Web.Models.Mapping _tabsAndPropertiesMapper = new TabsAndPropertiesMapper(localizedTextService); } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new ContentPropertyCollectionDto(), Map); mapper.Define((source, context) => new MediaItemDisplay(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs index 4414480b37..9dbcb6686b 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs @@ -16,13 +16,13 @@ namespace Umbraco.Web.Models.Mapping /// /// Declares model mappings for members. /// - internal class MemberMapperProfile : IMapperProfile + internal class MemberMapDefinition : IMapDefinition { private readonly CommonMapper _commonMapper; private readonly IMemberTypeService _memberTypeService; private readonly TabsAndPropertiesMapper _tabsAndPropertiesMapper; - public MemberMapperProfile(CommonMapper commonMapper, IMemberTypeService memberTypeService, ILocalizedTextService localizedTextService) + public MemberMapDefinition(CommonMapper commonMapper, IMemberTypeService memberTypeService, ILocalizedTextService localizedTextService) { _commonMapper = commonMapper; _memberTypeService = memberTypeService; @@ -30,7 +30,7 @@ namespace Umbraco.Web.Models.Mapping _tabsAndPropertiesMapper = new TabsAndPropertiesMapper(localizedTextService); } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new MemberDisplay(), Map); mapper.Define((source, context) => MemberService.CreateGenericMembershipProviderMember(source.UserName, source.Email, source.UserName, ""), Map); diff --git a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs similarity index 86% rename from src/Umbraco.Web/Models/Mapping/RedirectUrlMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs index d4ff6b04d6..73123a0407 100644 --- a/src/Umbraco.Web/Models/Mapping/RedirectUrlMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/RedirectUrlMapDefinition.cs @@ -4,18 +4,18 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class RedirectUrlMapperProfile : IMapperProfile + internal class RedirectUrlMapDefinition : IMapDefinition { private readonly IUmbracoContextAccessor _umbracoContextAccessor; - public RedirectUrlMapperProfile(IUmbracoContextAccessor umbracoContextAccessor) + public RedirectUrlMapDefinition(IUmbracoContextAccessor umbracoContextAccessor) { _umbracoContextAccessor = umbracoContextAccessor; } private UmbracoContext UmbracoContext => _umbracoContextAccessor.UmbracoContext; - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new ContentRedirectUrl(), Map); } diff --git a/src/Umbraco.Web/Models/Mapping/RelationMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/RelationMapDefinition.cs similarity index 95% rename from src/Umbraco.Web/Models/Mapping/RelationMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/RelationMapDefinition.cs index a56a3ca0a9..1da9a6cf97 100644 --- a/src/Umbraco.Web/Models/Mapping/RelationMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/RelationMapDefinition.cs @@ -5,9 +5,9 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class RelationMapperProfile : IMapperProfile + internal class RelationMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new RelationTypeDisplay(), Map); mapper.Define((source, context) => new RelationDisplay(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/SectionMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/SectionMapDefinition.cs similarity index 89% rename from src/Umbraco.Web/Models/Mapping/SectionMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/SectionMapDefinition.cs index e24c0133a8..e05e6e5c84 100644 --- a/src/Umbraco.Web/Models/Mapping/SectionMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/SectionMapDefinition.cs @@ -7,15 +7,15 @@ using Umbraco.Web.Sections; namespace Umbraco.Web.Models.Mapping { - internal class SectionMapperProfile : IMapperProfile + internal class SectionMapDefinition : IMapDefinition { private readonly ILocalizedTextService _textService; - public SectionMapperProfile(ILocalizedTextService textService) + public SectionMapDefinition(ILocalizedTextService textService) { _textService = textService; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new Section(), Map); diff --git a/src/Umbraco.Web/Models/Mapping/TagMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/TagMapDefinition.cs similarity index 83% rename from src/Umbraco.Web/Models/Mapping/TagMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/TagMapDefinition.cs index e10d7733b9..2161183504 100644 --- a/src/Umbraco.Web/Models/Mapping/TagMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/TagMapDefinition.cs @@ -3,9 +3,9 @@ using Umbraco.Core.Models; namespace Umbraco.Web.Models.Mapping { - internal class TagMapperProfile : IMapperProfile + internal class TagMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new TagModel(), Map); } diff --git a/src/Umbraco.Web/Models/Mapping/TemplateMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/TemplateMapDefinition.cs similarity index 93% rename from src/Umbraco.Web/Models/Mapping/TemplateMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/TemplateMapDefinition.cs index a95a979187..a1d1d7a612 100644 --- a/src/Umbraco.Web/Models/Mapping/TemplateMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/TemplateMapDefinition.cs @@ -4,9 +4,9 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { - internal class TemplateMapperProfile : IMapperProfile + internal class TemplateMapDefinition : IMapDefinition { - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new TemplateDisplay(), Map); mapper.Define((source, context) => new Template(source.Name, source.Alias), Map); diff --git a/src/Umbraco.Web/Models/Mapping/UserMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs similarity index 98% rename from src/Umbraco.Web/Models/Mapping/UserMapperProfile.cs rename to src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs index 8771b57de7..38cad2c9c2 100644 --- a/src/Umbraco.Web/Models/Mapping/UserMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs @@ -16,7 +16,7 @@ using Umbraco.Web.Services; namespace Umbraco.Web.Models.Mapping { - internal class UserMapperProfile : IMapperProfile + internal class UserMapDefinition : IMapDefinition { private readonly ISectionService _sectionService; private readonly IEntityService _entityService; @@ -26,7 +26,7 @@ namespace Umbraco.Web.Models.Mapping private readonly AppCaches _appCaches; private readonly IGlobalSettings _globalSettings; - public UserMapperProfile(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService, + public UserMapDefinition(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService, AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings) { _sectionService = sectionService; @@ -38,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping _globalSettings = globalSettings; } - public void DefineMaps(Mapper mapper) + public void DefineMaps(UmbracoMapper mapper) { mapper.Define((source, context) => new UserGroup { CreateDate = DateTime.UtcNow }, Map); mapper.Define(Map); @@ -332,7 +332,7 @@ namespace Umbraco.Web.Models.Mapping // helpers - private void MapUserGroupBasic(UserGroupBasic target, IEnumerable sourceAllowedSections, int? sourceStartContentId, int? sourceStartMediaId, Mapper mapper) + private void MapUserGroupBasic(UserGroupBasic target, IEnumerable sourceAllowedSections, int? sourceStartContentId, int? sourceStartMediaId, UmbracoMapper mapper) { var allSections = _sectionService.GetSections(); target.Sections = allSections.Where(x => sourceAllowedSections.Contains(x.Alias)).Select(mapper.Map
); @@ -376,7 +376,7 @@ namespace Umbraco.Web.Models.Mapping private static string MapContentTypeIcon(EntitySlim entity) => entity is ContentEntitySlim contentEntity ? contentEntity.ContentTypeIcon : null; - private IEnumerable GetStartNodes(int[] startNodeIds, UmbracoObjectTypes objectType, string localizedKey, Mapper mapper) + private IEnumerable GetStartNodes(int[] startNodeIds, UmbracoObjectTypes objectType, string localizedKey, UmbracoMapper mapper) { if (startNodeIds.Length <= 0) return Enumerable.Empty(); diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs index 4b38a1c63c..43db9ff0ba 100644 --- a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs +++ b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs @@ -23,13 +23,13 @@ namespace Umbraco.Web.Search private readonly UmbracoContext _umbracoContext; private readonly ILocalizationService _languageService; private readonly IEntityService _entityService; - private readonly Mapper _mapper; + private readonly UmbracoMapper _mapper; public UmbracoTreeSearcher(IExamineManager examineManager, UmbracoContext umbracoContext, ILocalizationService languageService, IEntityService entityService, - Mapper mapper) + UmbracoMapper mapper) { _examineManager = examineManager ?? throw new ArgumentNullException(nameof(examineManager)); _umbracoContext = umbracoContext; diff --git a/src/Umbraco.Web/Security/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/AppBuilderExtensions.cs index 751bc427b6..0a3e57c4fd 100644 --- a/src/Umbraco.Web/Security/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/AppBuilderExtensions.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.Security /// public static void ConfigureUserManagerForUmbracoBackOffice(this IAppBuilder app, ServiceContext services, - Mapper mapper, + UmbracoMapper mapper, IContentSection contentSettings, IGlobalSettings globalSettings, MembershipProviderBase userMembershipProvider) diff --git a/src/Umbraco.Web/Security/BackOfficeUserManager.cs b/src/Umbraco.Web/Security/BackOfficeUserManager.cs index 8874a38494..6205c1705c 100644 --- a/src/Umbraco.Web/Security/BackOfficeUserManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeUserManager.cs @@ -61,7 +61,7 @@ namespace Umbraco.Web.Security IEntityService entityService, IExternalLoginService externalLoginService, MembershipProviderBase membershipProvider, - Mapper mapper, + UmbracoMapper mapper, IContentSection contentSectionConfig, IGlobalSettings globalSettings) { diff --git a/src/Umbraco.Web/TagQuery.cs b/src/Umbraco.Web/TagQuery.cs index f07a122d7b..b7373a6d2c 100644 --- a/src/Umbraco.Web/TagQuery.cs +++ b/src/Umbraco.Web/TagQuery.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Umbraco.Core.Composing; +using Umbraco.Core.Mapping; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Services; using Umbraco.Web.Models; @@ -15,14 +15,16 @@ namespace Umbraco.Web { private readonly ITagService _tagService; private readonly IPublishedContentQuery _contentQuery; + private readonly UmbracoMapper _mapper; /// /// Initializes a new instance of the class. /// - public TagQuery(ITagService tagService, IPublishedContentQuery contentQuery) + public TagQuery(ITagService tagService, IPublishedContentQuery contentQuery, UmbracoMapper mapper) { _tagService = tagService ?? throw new ArgumentNullException(nameof(tagService)); _contentQuery = contentQuery ?? throw new ArgumentNullException(nameof(contentQuery)); + _mapper = mapper; } /// @@ -64,37 +66,37 @@ namespace Umbraco.Web /// public IEnumerable GetAllTags(string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetAllTags(group, culture)); + return _mapper.Map>(_tagService.GetAllTags(group, culture)); } /// public IEnumerable GetAllContentTags(string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetAllContentTags(group, culture)); + return _mapper.Map>(_tagService.GetAllContentTags(group, culture)); } /// public IEnumerable GetAllMediaTags(string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetAllMediaTags(group, culture)); + return _mapper.Map>(_tagService.GetAllMediaTags(group, culture)); } /// public IEnumerable GetAllMemberTags(string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetAllMemberTags(group, culture)); + return _mapper.Map>(_tagService.GetAllMemberTags(group, culture)); } /// public IEnumerable GetTagsForProperty(int contentId, string propertyTypeAlias, string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetTagsForProperty(contentId, propertyTypeAlias, group, culture)); + return _mapper.Map>(_tagService.GetTagsForProperty(contentId, propertyTypeAlias, group, culture)); } /// public IEnumerable GetTagsForEntity(int contentId, string group = null, string culture = null) { - return Current.Mapper.Map>(_tagService.GetTagsForEntity(contentId, group, culture)); + return _mapper.Map>(_tagService.GetTagsForEntity(contentId, group, culture)); } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 34964991df..6305c584ad 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -424,13 +424,13 @@ - - - - + + + + - - + + @@ -681,7 +681,7 @@ - + @@ -808,9 +808,9 @@ - - - + + + @@ -838,8 +838,8 @@ - - + + @@ -950,13 +950,13 @@ - - - - - + + + + + - + diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index 43c571035a..0633cca3a0 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web protected IUmbracoSettingsSection UmbracoSettings => Current.Configs.Settings(); protected IRuntimeState RuntimeState => Core.Composing.Current.RuntimeState; protected ServiceContext Services => Current.Services; - protected Mapper Mapper => Current.Mapper; + protected UmbracoMapper Mapper => Current.Mapper; /// /// Main startup method diff --git a/src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs b/src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs index 46b6fd9d03..2a57ec10b2 100644 --- a/src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.WebApi.Filters public sealed class CheckIfUserTicketDataIsStaleAttribute : ActionFilterAttribute { // this is an attribute - no choice - private Mapper Mapper => Current.Mapper; + private UmbracoMapper Mapper => Current.Mapper; public override async Task OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken) { diff --git a/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs b/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs index 73f119d3ae..89a630fb5d 100644 --- a/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs +++ b/src/Umbraco.Web/WebApi/UmbracoApiControllerBase.cs @@ -127,7 +127,7 @@ namespace Umbraco.Web.WebApi /// /// Gets the mapper. /// - public Mapper Mapper { get; } + public UmbracoMapper Mapper { get; } /// /// Gets the web security helper.