diff --git a/src/Umbraco.Core/Models/Content.cs b/src/Umbraco.Core/Models/Content.cs
index 2e99396707..10c28f0329 100644
--- a/src/Umbraco.Core/Models/Content.cs
+++ b/src/Umbraco.Core/Models/Content.cs
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(ContentMapper))]
public class Content : ContentBase, IContent
{
private IContentType _contentType;
diff --git a/src/Umbraco.Core/Models/ContentType.cs b/src/Umbraco.Core/Models/ContentType.cs
index 9211e1ac98..33d38fb108 100644
--- a/src/Umbraco.Core/Models/ContentType.cs
+++ b/src/Umbraco.Core/Models/ContentType.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(ContentTypeMapper))]
public class ContentType : ContentTypeCompositionBase, IContentType
{
private int _defaultTemplate;
diff --git a/src/Umbraco.Core/Models/DataTypeDefinition.cs b/src/Umbraco.Core/Models/DataTypeDefinition.cs
index 6e646e905d..dde0f7ee84 100644
--- a/src/Umbraco.Core/Models/DataTypeDefinition.cs
+++ b/src/Umbraco.Core/Models/DataTypeDefinition.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -14,6 +15,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(DataTypeDefinitionMapper))]
public class DataTypeDefinition : Entity, IDataTypeDefinition
{
private int _parentId;
diff --git a/src/Umbraco.Core/Models/DictionaryItem.cs b/src/Umbraco.Core/Models/DictionaryItem.cs
index f4ba50bed4..dd9742a485 100644
--- a/src/Umbraco.Core/Models/DictionaryItem.cs
+++ b/src/Umbraco.Core/Models/DictionaryItem.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(DictionaryMapper))]
public class DictionaryItem : Entity, IDictionaryItem
{
private Guid _parentId;
diff --git a/src/Umbraco.Core/Models/DictionaryTranslation.cs b/src/Umbraco.Core/Models/DictionaryTranslation.cs
index 0e0896989e..4be6ea58e6 100644
--- a/src/Umbraco.Core/Models/DictionaryTranslation.cs
+++ b/src/Umbraco.Core/Models/DictionaryTranslation.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -10,6 +11,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(DictionaryTranslationMapper))]
public class DictionaryTranslation : Entity, IDictionaryTranslation
{
private ILanguage _language;
diff --git a/src/Umbraco.Core/Models/IContent.cs b/src/Umbraco.Core/Models/IContent.cs
index 7926c595b0..25506b622b 100644
--- a/src/Umbraco.Core/Models/IContent.cs
+++ b/src/Umbraco.Core/Models/IContent.cs
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
///
/// Defines a Content object
///
+ [Mapper(typeof(ContentMapper))]
public interface IContent : IContentBase
{
///
diff --git a/src/Umbraco.Core/Models/IContentType.cs b/src/Umbraco.Core/Models/IContentType.cs
index 3e61b98510..ea084d7a40 100644
--- a/src/Umbraco.Core/Models/IContentType.cs
+++ b/src/Umbraco.Core/Models/IContentType.cs
@@ -1,10 +1,12 @@
using System.Collections.Generic;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
///
/// Defines a ContentType, which Content is based on
///
+ [Mapper(typeof(ContentTypeMapper))]
public interface IContentType : IContentTypeComposition
{
///
diff --git a/src/Umbraco.Core/Models/IDataTypeDefinition.cs b/src/Umbraco.Core/Models/IDataTypeDefinition.cs
index e2ed1ef52e..277ff4a7e3 100644
--- a/src/Umbraco.Core/Models/IDataTypeDefinition.cs
+++ b/src/Umbraco.Core/Models/IDataTypeDefinition.cs
@@ -1,8 +1,10 @@
using System;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
+ [Mapper(typeof(DataTypeDefinitionMapper))]
public interface IDataTypeDefinition : IUmbracoEntity
{
///
diff --git a/src/Umbraco.Core/Models/IDictionaryItem.cs b/src/Umbraco.Core/Models/IDictionaryItem.cs
index 9c748dde40..eb2e6bd6f8 100644
--- a/src/Umbraco.Core/Models/IDictionaryItem.cs
+++ b/src/Umbraco.Core/Models/IDictionaryItem.cs
@@ -2,9 +2,11 @@ using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
+ [Mapper(typeof(DictionaryMapper))]
public interface IDictionaryItem : IAggregateRoot
{
///
diff --git a/src/Umbraco.Core/Models/IDictionaryTranslation.cs b/src/Umbraco.Core/Models/IDictionaryTranslation.cs
index 7011e7faf7..1ae07486ea 100644
--- a/src/Umbraco.Core/Models/IDictionaryTranslation.cs
+++ b/src/Umbraco.Core/Models/IDictionaryTranslation.cs
@@ -1,8 +1,10 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
+ [Mapper(typeof(DictionaryTranslationMapper))]
public interface IDictionaryTranslation : IEntity
{
///
diff --git a/src/Umbraco.Core/Models/ILanguage.cs b/src/Umbraco.Core/Models/ILanguage.cs
index 7457a097b8..0b6e3cea93 100644
--- a/src/Umbraco.Core/Models/ILanguage.cs
+++ b/src/Umbraco.Core/Models/ILanguage.cs
@@ -1,9 +1,11 @@
using System.Globalization;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
+ [Mapper(typeof(LanguageMapper))]
public interface ILanguage : IAggregateRoot
{
///
diff --git a/src/Umbraco.Core/Models/IMedia.cs b/src/Umbraco.Core/Models/IMedia.cs
index dd58421cb6..7bd35d6f64 100644
--- a/src/Umbraco.Core/Models/IMedia.cs
+++ b/src/Umbraco.Core/Models/IMedia.cs
@@ -1,5 +1,8 @@
-namespace Umbraco.Core.Models
+using Umbraco.Core.Persistence.Mappers;
+
+namespace Umbraco.Core.Models
{
+ [Mapper(typeof(MediaMapper))]
public interface IMedia : IContentBase
{
///
diff --git a/src/Umbraco.Core/Models/IMediaType.cs b/src/Umbraco.Core/Models/IMediaType.cs
index e72471fc88..7ec7329537 100644
--- a/src/Umbraco.Core/Models/IMediaType.cs
+++ b/src/Umbraco.Core/Models/IMediaType.cs
@@ -1,8 +1,11 @@
-namespace Umbraco.Core.Models
+using Umbraco.Core.Persistence.Mappers;
+
+namespace Umbraco.Core.Models
{
///
/// Defines a ContentType, which Media is based on
///
+ [Mapper(typeof(MediaTypeMapper))]
public interface IMediaType : IContentTypeComposition
{
diff --git a/src/Umbraco.Core/Models/Language.cs b/src/Umbraco.Core/Models/Language.cs
index 307584de11..f098e0470c 100644
--- a/src/Umbraco.Core/Models/Language.cs
+++ b/src/Umbraco.Core/Models/Language.cs
@@ -3,6 +3,7 @@ using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(LanguageMapper))]
public class Language : Entity, ILanguage
{
private string _isoCode;
diff --git a/src/Umbraco.Core/Models/Media.cs b/src/Umbraco.Core/Models/Media.cs
index 6b8c8d55f7..a30ec79d7c 100644
--- a/src/Umbraco.Core/Models/Media.cs
+++ b/src/Umbraco.Core/Models/Media.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -8,6 +9,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(MediaMapper))]
public class Media : ContentBase, IMedia
{
private IMediaType _contentType;
diff --git a/src/Umbraco.Core/Models/MediaType.cs b/src/Umbraco.Core/Models/MediaType.cs
index c734981365..e505ead334 100644
--- a/src/Umbraco.Core/Models/MediaType.cs
+++ b/src/Umbraco.Core/Models/MediaType.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -8,6 +9,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(MediaTypeMapper))]
public class MediaType : ContentTypeCompositionBase, IMediaType
{
public MediaType(int parentId) : base(parentId)
diff --git a/src/Umbraco.Core/Models/Membership/IUser.cs b/src/Umbraco.Core/Models/Membership/IUser.cs
index 6b62889eb3..c43cd4ca59 100644
--- a/src/Umbraco.Core/Models/Membership/IUser.cs
+++ b/src/Umbraco.Core/Models/Membership/IUser.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models.Membership
{
@@ -6,6 +7,7 @@ namespace Umbraco.Core.Models.Membership
/// Defines the interface for a
///
/// Will be left internal until a proper Membership implementation is part of the roadmap
+ [Mapper(typeof(UserMapper))]
internal interface IUser : IMembershipUser
{
string Name { get; set; }
diff --git a/src/Umbraco.Core/Models/Membership/IUserType.cs b/src/Umbraco.Core/Models/Membership/IUserType.cs
index 229cbfee53..7af8c104f7 100644
--- a/src/Umbraco.Core/Models/Membership/IUserType.cs
+++ b/src/Umbraco.Core/Models/Membership/IUserType.cs
@@ -1,7 +1,9 @@
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models.Membership
{
+ [Mapper(typeof(UserTypeMapper))]
internal interface IUserType : IAggregateRoot
{
string Alias { get; set; }
diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs
index f815bac147..371c621d51 100644
--- a/src/Umbraco.Core/Models/Membership/User.cs
+++ b/src/Umbraco.Core/Models/Membership/User.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models.Membership
{
@@ -15,6 +16,7 @@ namespace Umbraco.Core.Models.Membership
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(UserMapper))]
internal class User : UserProfile, IUser
{
private bool _hasIdentity;
diff --git a/src/Umbraco.Core/Models/Membership/UserType.cs b/src/Umbraco.Core/Models/Membership/UserType.cs
index 9a9083c88e..be90dfa7e8 100644
--- a/src/Umbraco.Core/Models/Membership/UserType.cs
+++ b/src/Umbraco.Core/Models/Membership/UserType.cs
@@ -1,6 +1,7 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models.Membership
{
@@ -13,6 +14,7 @@ namespace Umbraco.Core.Models.Membership
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(UserTypeMapper))]
internal class UserType : Entity, IUserType
{
[DataMember]
diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs
index 049a5baa9a..62895090d2 100644
--- a/src/Umbraco.Core/Models/Property.cs
+++ b/src/Umbraco.Core/Models/Property.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -10,6 +11,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(PropertyMapper))]
public class Property : Entity
{
private readonly PropertyType _propertyType;
diff --git a/src/Umbraco.Core/Models/PropertyGroup.cs b/src/Umbraco.Core/Models/PropertyGroup.cs
index 8b1467ec48..ec78be87af 100644
--- a/src/Umbraco.Core/Models/PropertyGroup.cs
+++ b/src/Umbraco.Core/Models/PropertyGroup.cs
@@ -3,6 +3,7 @@ using System.Collections.Specialized;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(PropertyGroupMapper))]
public class PropertyGroup : Entity, IEquatable
{
private string _name;
diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs
index 874e58ea6f..abb62ce54f 100644
--- a/src/Umbraco.Core/Models/PropertyType.cs
+++ b/src/Umbraco.Core/Models/PropertyType.cs
@@ -3,6 +3,7 @@ using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(PropertyTypeMapper))]
public class PropertyType : Entity, IEquatable
{
//private SerializationService _service;
diff --git a/src/Umbraco.Core/Models/Relation.cs b/src/Umbraco.Core/Models/Relation.cs
index 8193d529c9..5ecb372c2b 100644
--- a/src/Umbraco.Core/Models/Relation.cs
+++ b/src/Umbraco.Core/Models/Relation.cs
@@ -2,6 +2,7 @@
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -10,6 +11,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(RelationMapper))]
public class Relation : Entity, IAggregateRoot
{
//NOTE: The datetime column from umbracoRelation is set on CreateDate on the Entity
diff --git a/src/Umbraco.Core/Models/RelationType.cs b/src/Umbraco.Core/Models/RelationType.cs
index 6cda501c59..bb420286dd 100644
--- a/src/Umbraco.Core/Models/RelationType.cs
+++ b/src/Umbraco.Core/Models/RelationType.cs
@@ -2,6 +2,7 @@ using System;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -10,6 +11,7 @@ namespace Umbraco.Core.Models
///
[Serializable]
[DataContract(IsReference = true)]
+ [Mapper(typeof(RelationTypeMapper))]
public class RelationType : Entity, IAggregateRoot
{
private string _name;
diff --git a/src/Umbraco.Core/Models/ServerRegistration.cs b/src/Umbraco.Core/Models/ServerRegistration.cs
index 3fdb96265f..49770485b5 100644
--- a/src/Umbraco.Core/Models/ServerRegistration.cs
+++ b/src/Umbraco.Core/Models/ServerRegistration.cs
@@ -5,7 +5,7 @@ using Umbraco.Core.Sync;
namespace Umbraco.Core.Models
{
-
+ [Mapper(typeof(ServerRegistrationMapper))]
internal class ServerRegistration : Entity, IServerAddress, IAggregateRoot
{
public ServerRegistration()
diff --git a/src/Umbraco.Core/Persistence/Mappers/ContentMapper.cs b/src/Umbraco.Core/Persistence/Mappers/ContentMapper.cs
index 12321a0353..34023400be 100644
--- a/src/Umbraco.Core/Persistence/Mappers/ContentMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/ContentMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static ContentMapper Instance = new ContentMapper();
-
- private ContentMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public ContentMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/ContentTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/ContentTypeMapper.cs
index bf212e9745..fb1f4e89ca 100644
--- a/src/Umbraco.Core/Persistence/Mappers/ContentTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/ContentTypeMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static ContentTypeMapper Instance = new ContentTypeMapper();
-
- private ContentTypeMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public ContentTypeMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs
index 837b09f987..69bb08afb5 100644
--- a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static DataTypeDefinitionMapper Instance = new DataTypeDefinitionMapper();
-
- private DataTypeDefinitionMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public DataTypeDefinitionMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/DictionaryMapper.cs b/src/Umbraco.Core/Persistence/Mappers/DictionaryMapper.cs
index a6e13a8596..459704e63d 100644
--- a/src/Umbraco.Core/Persistence/Mappers/DictionaryMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/DictionaryMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static DictionaryMapper Instance = new DictionaryMapper();
-
- private DictionaryMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public DictionaryMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/DictionaryTranslationMapper.cs b/src/Umbraco.Core/Persistence/Mappers/DictionaryTranslationMapper.cs
index 7b0409c3b3..ef45899595 100644
--- a/src/Umbraco.Core/Persistence/Mappers/DictionaryTranslationMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/DictionaryTranslationMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static DictionaryTranslationMapper Instance = new DictionaryTranslationMapper();
-
- private DictionaryTranslationMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public DictionaryTranslationMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/LanguageMapper.cs b/src/Umbraco.Core/Persistence/Mappers/LanguageMapper.cs
index 3af6b5f77f..289decec4e 100644
--- a/src/Umbraco.Core/Persistence/Mappers/LanguageMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/LanguageMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static LanguageMapper Instance = new LanguageMapper();
-
- private LanguageMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public LanguageMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/MapperAttribute.cs b/src/Umbraco.Core/Persistence/Mappers/MapperAttribute.cs
new file mode 100644
index 0000000000..b9e033ac88
--- /dev/null
+++ b/src/Umbraco.Core/Persistence/Mappers/MapperAttribute.cs
@@ -0,0 +1,18 @@
+using System;
+
+namespace Umbraco.Core.Persistence.Mappers
+{
+ ///
+ /// An attribute used to decorate entities in order to associate with a mapper
+ ///
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
+ internal sealed class MapperAttribute : Attribute
+ {
+ public Type MapperType { get; private set; }
+
+ public MapperAttribute(Type mapperType)
+ {
+ MapperType = mapperType;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Persistence/Mappers/MappingResolver.cs b/src/Umbraco.Core/Persistence/Mappers/MappingResolver.cs
index 92dd51c5b2..6aa6d8f368 100644
--- a/src/Umbraco.Core/Persistence/Mappers/MappingResolver.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/MappingResolver.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Concurrent;
+using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -6,59 +8,63 @@ namespace Umbraco.Core.Persistence.Mappers
{
internal static class MappingResolver
{
+ ///
+ /// Caches the type -> mapper so that we don't have to type check each time we want one or lookup the attribute
+ ///
+ private static readonly ConcurrentDictionary MapperCache = new ConcurrentDictionary();
+
+ ///
+ /// Return a mapper by type
+ ///
+ ///
+ ///
internal static BaseMapper ResolveMapperByType(Type type)
{
- if (type == typeof(ServerRegistration))
- return ServerRegistrationMapper.Instance;
+ return MapperCache.GetOrAdd(type, type1 =>
+ {
- if (type == typeof (IContent) || type == typeof (Content))
- return ContentMapper.Instance;
+ //first check if we can resolve it by attribute
- if (type == typeof (IContentType) || type == typeof (ContentType))
- return ContentTypeMapper.Instance;
+ var byAttribute = TryGetMapperByAttribute(type);
+ if (byAttribute.Success)
+ {
+ return byAttribute.Result;
+ }
- if (type == typeof(IDataTypeDefinition) || type == typeof(DataTypeDefinition))
- return DataTypeDefinitionMapper.Instance;
+ //static mapper registration if not using attributes, could be something like this:
+ //if (type == typeof (UserType))
+ // return new UserTypeMapper();
- if (type == typeof(IDictionaryItem) || type == typeof(DictionaryItem))
- return DictionaryMapper.Instance;
-
- if (type == typeof(IDictionaryTranslation) || type == typeof(DictionaryTranslation))
- return DictionaryTranslationMapper.Instance;
-
- if (type == typeof(ILanguage) || type == typeof(Language))
- return LanguageMapper.Instance;
-
- if (type == typeof(IMedia) || type == typeof(Models.Media))
- return MediaMapper.Instance;
-
- if (type == typeof(IMediaType) || type == typeof(MediaType))
- return MediaTypeMapper.Instance;
-
- if (type == typeof(PropertyGroup))
- return PropertyGroupMapper.Instance;
-
- if (type == typeof(Property))
- return PropertyMapper.Instance;
-
- if (type == typeof(PropertyType))
- return PropertyTypeMapper.Instance;
-
- if (type == typeof(Relation))
- return RelationMapper.Instance;
-
- if (type == typeof(RelationType))
- return RelationTypeMapper.Instance;
-
- if (type == typeof(IUser) || type == typeof(User))
- return UserMapper.Instance;
-
- if (type == typeof(IUserType) || type == typeof(UserType))
- return UserTypeMapper.Instance;
-
- throw new Exception("Invalid Type: A Mapper could not be resolved based on the passed in Type");
+ throw new Exception("Invalid Type: A Mapper could not be resolved based on the passed in Type");
+ });
}
+ ///
+ /// Check the entity type to see if it has a mapper attribute assigned and try to instantiate it
+ ///
+ ///
+ ///
+ private static Attempt TryGetMapperByAttribute(Type type)
+ {
+ var attribute = type.GetCustomAttribute(false);
+ if (attribute == null)
+ {
+ return Attempt.False;
+ }
+ try
+ {
+ var instance = Activator.CreateInstance(attribute.MapperType) as BaseMapper;
+ return instance != null
+ ? new Attempt(true, instance)
+ : Attempt.False;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Error(typeof(MappingResolver), "Could not instantiate mapper of type " + attribute.MapperType, ex);
+ return new Attempt(ex);
+ }
+ }
+
internal static string GetMapping(Type type, string propertyName)
{
var mapper = ResolveMapperByType(type);
diff --git a/src/Umbraco.Core/Persistence/Mappers/MediaMapper.cs b/src/Umbraco.Core/Persistence/Mappers/MediaMapper.cs
index a6d3f29ac6..8f28ac1ec5 100644
--- a/src/Umbraco.Core/Persistence/Mappers/MediaMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/MediaMapper.cs
@@ -13,9 +13,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static MediaMapper Instance = new MediaMapper();
-
- private MediaMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public MediaMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/MediaTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/MediaTypeMapper.cs
index 9ee11ff5fa..245d8dca76 100644
--- a/src/Umbraco.Core/Persistence/Mappers/MediaTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/MediaTypeMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static MediaTypeMapper Instance = new MediaTypeMapper();
-
- private MediaTypeMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public MediaTypeMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/PropertyGroupMapper.cs b/src/Umbraco.Core/Persistence/Mappers/PropertyGroupMapper.cs
index 5f519d9772..a43de4e1c4 100644
--- a/src/Umbraco.Core/Persistence/Mappers/PropertyGroupMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/PropertyGroupMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static readonly PropertyGroupMapper Instance = new PropertyGroupMapper();
-
- private PropertyGroupMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public PropertyGroupMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/PropertyMapper.cs b/src/Umbraco.Core/Persistence/Mappers/PropertyMapper.cs
index 795e5a9216..3746fa7697 100644
--- a/src/Umbraco.Core/Persistence/Mappers/PropertyMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/PropertyMapper.cs
@@ -10,9 +10,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static PropertyMapper Instance = new PropertyMapper();
-
- private PropertyMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public PropertyMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
index 1df4c94ee1..e2ba7d93f2 100644
--- a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static PropertyTypeMapper Instance = new PropertyTypeMapper();
-
- private PropertyTypeMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public PropertyTypeMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/RelationMapper.cs b/src/Umbraco.Core/Persistence/Mappers/RelationMapper.cs
index a0dbb80805..9175516599 100644
--- a/src/Umbraco.Core/Persistence/Mappers/RelationMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/RelationMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static RelationMapper Instance = new RelationMapper();
-
- private RelationMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public RelationMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/RelationTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/RelationTypeMapper.cs
index eb64df3800..8659dddbec 100644
--- a/src/Umbraco.Core/Persistence/Mappers/RelationTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/RelationTypeMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static RelationTypeMapper Instance = new RelationTypeMapper();
-
- private RelationTypeMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public RelationTypeMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/ServerRegistrationMapper.cs b/src/Umbraco.Core/Persistence/Mappers/ServerRegistrationMapper.cs
index bf53eb9bd0..8d2a8dbf3d 100644
--- a/src/Umbraco.Core/Persistence/Mappers/ServerRegistrationMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/ServerRegistrationMapper.cs
@@ -6,14 +6,13 @@ using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Mappers
{
-
internal sealed class ServerRegistrationMapper : BaseMapper
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static readonly ServerRegistrationMapper Instance = new ServerRegistrationMapper();
-
- private ServerRegistrationMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public ServerRegistrationMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs b/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
index 04393bd37c..ce750b4ed2 100644
--- a/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
@@ -10,9 +10,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static UserMapper Instance = new UserMapper();
-
- private UserMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public UserMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Persistence/Mappers/UserTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/UserTypeMapper.cs
index ab9f8ddbc6..ad62bc51e0 100644
--- a/src/Umbraco.Core/Persistence/Mappers/UserTypeMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/UserTypeMapper.cs
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence.Mappers
{
private static readonly ConcurrentDictionary PropertyInfoCache = new ConcurrentDictionary();
- internal static UserTypeMapper Instance = new UserTypeMapper();
-
- private UserTypeMapper()
+ //NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
+ // otherwise that would fail because there is no public constructor.
+ public UserTypeMapper()
{
BuildMap();
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 1dffbd99b7..1ef57cd631 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -221,6 +221,7 @@
+
diff --git a/src/Umbraco.Tests/Persistence/Mappers/ContentMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/ContentMapperTest.cs
index 83dced8d28..d7d5a3515d 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/ContentMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/ContentMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentMapper.Instance.Map("Id");
+ string column = new ContentMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentMapper.Instance.Map("Trashed");
+ string column = new ContentMapper().Map("Trashed");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[trashed]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentMapper.Instance.Map("Published");
+ string column = new ContentMapper().Map("Published");
// Assert
Assert.That(column, Is.EqualTo("[cmsDocument].[published]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentMapper.Instance.Map("Version");
+ string column = new ContentMapper().Map("Version");
// Assert
Assert.That(column, Is.EqualTo("[cmsContentVersion].[VersionId]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/ContentTypeMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/ContentTypeMapperTest.cs
index 47b201d750..7a9bd82030 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/ContentTypeMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/ContentTypeMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentTypeMapper.Instance.Map("Id");
+ string column = new ContentTypeMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentTypeMapper.Instance.Map("Name");
+ string column = new ContentTypeMapper().Map("Name");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[text]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentTypeMapper.Instance.Map("Thumbnail");
+ string column = new ContentTypeMapper().Map("Thumbnail");
// Assert
Assert.That(column, Is.EqualTo("[cmsContentType].[thumbnail]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = ContentTypeMapper.Instance.Map("Description");
+ string column = new ContentTypeMapper().Map("Description");
// Assert
Assert.That(column, Is.EqualTo("[cmsContentType].[description]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs
index dfaa1ccd09..9836c7e8e1 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DataTypeDefinitionMapper.Instance.Map("Id");
+ string column = new DataTypeDefinitionMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DataTypeDefinitionMapper.Instance.Map("Key");
+ string column = new DataTypeDefinitionMapper().Map("Key");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[uniqueID]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DataTypeDefinitionMapper.Instance.Map("DatabaseType");
+ string column = new DataTypeDefinitionMapper().Map("DatabaseType");
// Assert
Assert.That(column, Is.EqualTo("[cmsDataType].[dbType]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DataTypeDefinitionMapper.Instance.Map("ControlId");
+ string column = new DataTypeDefinitionMapper().Map("ControlId");
// Assert
Assert.That(column, Is.EqualTo("[cmsDataType].[controlId]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/DictionaryMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/DictionaryMapperTest.cs
index 02c19f47f5..59743c22d7 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/DictionaryMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/DictionaryMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryMapper.Instance.Map("Id");
+ string column = new DictionaryMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[cmsDictionary].[pk]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryMapper.Instance.Map("Key");
+ string column = new DictionaryMapper().Map("Key");
// Assert
Assert.That(column, Is.EqualTo("[cmsDictionary].[id]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryMapper.Instance.Map("ItemKey");
+ string column = new DictionaryMapper().Map("ItemKey");
// Assert
Assert.That(column, Is.EqualTo("[cmsDictionary].[key]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/DictionaryTranslationMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/DictionaryTranslationMapperTest.cs
index bfec65989d..03c9aec4ba 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/DictionaryTranslationMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/DictionaryTranslationMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryTranslationMapper.Instance.Map("Key");
+ string column = new DictionaryTranslationMapper().Map("Key");
// Assert
Assert.That(column, Is.EqualTo("[cmsLanguageText].[UniqueId]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryTranslationMapper.Instance.Map("Language");
+ string column = new DictionaryTranslationMapper().Map("Language");
// Assert
Assert.That(column, Is.EqualTo("[cmsLanguageText].[languageId]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = DictionaryTranslationMapper.Instance.Map("Value");
+ string column = new DictionaryTranslationMapper().Map("Value");
// Assert
Assert.That(column, Is.EqualTo("[cmsLanguageText].[value]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/LanguageMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/LanguageMapperTest.cs
index 0e98405bb2..84dc7d883f 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/LanguageMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/LanguageMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = LanguageMapper.Instance.Map("Id");
+ string column = new LanguageMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoLanguage].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = LanguageMapper.Instance.Map("IsoCode");
+ string column = new LanguageMapper().Map("IsoCode");
// Assert
Assert.That(column, Is.EqualTo("[umbracoLanguage].[languageISOCode]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = LanguageMapper.Instance.Map("CultureName");
+ string column = new LanguageMapper().Map("CultureName");
// Assert
Assert.That(column, Is.EqualTo("[umbracoLanguage].[languageCultureName]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/MediaMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/MediaMapperTest.cs
index a7c9682ab9..71609eb9dd 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/MediaMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/MediaMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = MediaMapper.Instance.Map("Id");
+ string column = new MediaMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = MediaMapper.Instance.Map("Trashed");
+ string column = new MediaMapper().Map("Trashed");
// Assert
Assert.That(column, Is.EqualTo("[umbracoNode].[trashed]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = MediaMapper.Instance.Map("UpdateDate");
+ string column = new MediaMapper().Map("UpdateDate");
// Assert
Assert.That(column, Is.EqualTo("[cmsContentVersion].[VersionDate]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = MediaMapper.Instance.Map("Version");
+ string column = new MediaMapper().Map("Version");
// Assert
Assert.That(column, Is.EqualTo("[cmsContentVersion].[VersionId]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/PropertyGroupMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/PropertyGroupMapperTest.cs
index 1fad331023..b3d27b8e65 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/PropertyGroupMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/PropertyGroupMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyGroupMapper.Instance.Map("Id");
+ string column = new PropertyGroupMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyTypeGroup].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyGroupMapper.Instance.Map("ParentId");
+ string column = new PropertyGroupMapper().Map("ParentId");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyTypeGroup].[parentGroupId]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyGroupMapper.Instance.Map("SortOrder");
+ string column = new PropertyGroupMapper().Map("SortOrder");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyTypeGroup].[sortorder]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyGroupMapper.Instance.Map("Name");
+ string column = new PropertyGroupMapper().Map("Name");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyTypeGroup].[text]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs
index f7bfbd71ad..06ed3044ad 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("Id");
+ string column = new PropertyTypeMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyType].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("Alias");
+ string column = new PropertyTypeMapper().Map("Alias");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyType].[Alias]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("DataTypeDefinitionId");
+ string column = new PropertyTypeMapper().Map("DataTypeDefinitionId");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyType].[dataTypeId]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("SortOrder");
+ string column = new PropertyTypeMapper().Map("SortOrder");
// Assert
Assert.That(column, Is.EqualTo("[cmsPropertyType].[sortOrder]"));
@@ -66,7 +66,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("DataTypeId");
+ string column = new PropertyTypeMapper().Map("DataTypeId");
// Assert
Assert.That(column, Is.EqualTo("[cmsDataType].[controlId]"));
@@ -79,7 +79,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = PropertyTypeMapper.Instance.Map("DataTypeDatabaseType");
+ string column = new PropertyTypeMapper().Map("DataTypeDatabaseType");
// Assert
Assert.That(column, Is.EqualTo("[cmsDataType].[dbType]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/RelationMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/RelationMapperTest.cs
index 179ae7a25d..ce0cbf1325 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/RelationMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/RelationMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationMapper.Instance.Map("Id");
+ string column = new RelationMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelation].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationMapper.Instance.Map("ChildId");
+ string column = new RelationMapper().Map("ChildId");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelation].[childId]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationMapper.Instance.Map("CreateDate");
+ string column = new RelationMapper().Map("CreateDate");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelation].[datetime]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationMapper.Instance.Map("Comment");
+ string column = new RelationMapper().Map("Comment");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelation].[comment]"));
@@ -66,7 +66,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationMapper.Instance.Map("RelationTypeId");
+ string column = new RelationMapper().Map("RelationTypeId");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelation].[relType]"));
diff --git a/src/Umbraco.Tests/Persistence/Mappers/RelationTypeMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/RelationTypeMapperTest.cs
index 2fde906148..06c5ccdab4 100644
--- a/src/Umbraco.Tests/Persistence/Mappers/RelationTypeMapperTest.cs
+++ b/src/Umbraco.Tests/Persistence/Mappers/RelationTypeMapperTest.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationTypeMapper.Instance.Map("Id");
+ string column = new RelationTypeMapper().Map("Id");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelationType].[id]"));
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationTypeMapper.Instance.Map("Alias");
+ string column = new RelationTypeMapper().Map("Alias");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelationType].[alias]"));
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationTypeMapper.Instance.Map("ChildObjectType");
+ string column = new RelationTypeMapper().Map("ChildObjectType");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelationType].[childObjectType]"));
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Persistence.Mappers
SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider;
// Act
- string column = RelationTypeMapper.Instance.Map("IsBidirectional");
+ string column = new RelationTypeMapper().Map("IsBidirectional");
// Assert
Assert.That(column, Is.EqualTo("[umbracoRelationType].[dual]"));
diff --git a/src/Umbraco.Web.UI/config/ClientDependency.config b/src/Umbraco.Web.UI/config/ClientDependency.config
index 99957f0fa8..dcb15999aa 100644
--- a/src/Umbraco.Web.UI/config/ClientDependency.config
+++ b/src/Umbraco.Web.UI/config/ClientDependency.config
@@ -10,7 +10,7 @@ NOTES:
* Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config
* A new version will invalidate both client and server cache and create new persisted files
-->
-
+