diff --git a/src/Umbraco.Core/Models/AuditEntry.cs b/src/Umbraco.Core/Models/AuditEntry.cs
index da56c6c318..d12163f394 100644
--- a/src/Umbraco.Core/Models/AuditEntry.cs
+++ b/src/Umbraco.Core/Models/AuditEntry.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
@@ -19,7 +18,7 @@ namespace Umbraco.Core.Models
private string _affectedDetails;
private string _eventType;
private string _eventDetails;
-
+
///
public int PerformingUserId
{
@@ -49,28 +48,28 @@ namespace Umbraco.Core.Models
}
///
- public int AffectedUserId
+ public int AffectedUserId
{
get => _affectedUserId;
set => SetPropertyValueAndDetectChanges(value, ref _affectedUserId, nameof(AffectedUserId));
}
///
- public string AffectedDetails
+ public string AffectedDetails
{
get => _affectedDetails;
set => SetPropertyValueAndDetectChanges(value, ref _affectedDetails, nameof(AffectedDetails));
}
///
- public string EventType
+ public string EventType
{
get => _eventType;
set => SetPropertyValueAndDetectChanges(value, ref _eventType, nameof(EventType));
}
///
- public string EventDetails
+ public string EventDetails
{
get => _eventDetails;
set => SetPropertyValueAndDetectChanges(value, ref _eventDetails, nameof(EventDetails));
diff --git a/src/Umbraco.Core/Models/Consent.cs b/src/Umbraco.Core/Models/Consent.cs
index cca1db41f1..4f7543fd59 100644
--- a/src/Umbraco.Core/Models/Consent.cs
+++ b/src/Umbraco.Core/Models/Consent.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
@@ -19,7 +18,7 @@ namespace Umbraco.Core.Models
private string _action;
private ConsentState _state;
private string _comment;
-
+
///
public bool Current
{
diff --git a/src/Umbraco.Core/Models/Content.cs b/src/Umbraco.Core/Models/Content.cs
index 4fda1ff23d..dd4ba13c33 100644
--- a/src/Umbraco.Core/Models/Content.cs
+++ b/src/Umbraco.Core/Models/Content.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Exceptions;
diff --git a/src/Umbraco.Core/Models/ContentBase.cs b/src/Umbraco.Core/Models/ContentBase.cs
index 705fa2cfb0..a1fb5da308 100644
--- a/src/Umbraco.Core/Models/ContentBase.cs
+++ b/src/Umbraco.Core/Models/ContentBase.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.Entities;
diff --git a/src/Umbraco.Core/Models/ContentCultureInfos.cs b/src/Umbraco.Core/Models/ContentCultureInfos.cs
index a0a4a7c472..c8c4bea56a 100644
--- a/src/Umbraco.Core/Models/ContentCultureInfos.cs
+++ b/src/Umbraco.Core/Models/ContentCultureInfos.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.Entities;
@@ -13,7 +12,7 @@ namespace Umbraco.Core.Models
{
private DateTime _date;
private string _name;
-
+
///
/// Initializes a new instance of the class.
///
@@ -101,6 +100,5 @@ namespace Umbraco.Core.Models
Deconstruct(out culture, out name);
date = Date;
}
-
}
}
diff --git a/src/Umbraco.Core/Models/ContentType.cs b/src/Umbraco.Core/Models/ContentType.cs
index 97534835d1..61fabe6fb0 100644
--- a/src/Umbraco.Core/Models/ContentType.cs
+++ b/src/Umbraco.Core/Models/ContentType.cs
@@ -67,8 +67,8 @@ namespace Umbraco.Core.Models
[DataMember]
internal int DefaultTemplateId
{
- get { return _defaultTemplate; }
- set { SetPropertyValueAndDetectChanges(value, ref _defaultTemplate, nameof(DefaultTemplateId)); }
+ get => _defaultTemplate;
+ set => SetPropertyValueAndDetectChanges(value, ref _defaultTemplate, nameof(DefaultTemplateId));
}
///
diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs
index 3f45f424da..2aa114a88f 100644
--- a/src/Umbraco.Core/Models/ContentTypeBase.cs
+++ b/src/Umbraco.Core/Models/ContentTypeBase.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Strings;
@@ -18,7 +17,6 @@ namespace Umbraco.Core.Models
[DebuggerDisplay("Id: {Id}, Name: {Name}, Alias: {Alias}")]
public abstract class ContentTypeBase : TreeEntityBase, IContentTypeBase
{
-
private string _alias;
private string _description;
private string _icon = "icon-folder";
diff --git a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs
index 7a8e91845a..ec6f803107 100644
--- a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs
+++ b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Exceptions;
diff --git a/src/Umbraco.Core/Models/DataType.cs b/src/Umbraco.Core/Models/DataType.cs
index 423895b475..8745e6dbec 100644
--- a/src/Umbraco.Core/Models/DataType.cs
+++ b/src/Umbraco.Core/Models/DataType.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models.Entities;
diff --git a/src/Umbraco.Core/Models/DictionaryItem.cs b/src/Umbraco.Core/Models/DictionaryItem.cs
index 00c4e1a96c..c23e8f86a4 100644
--- a/src/Umbraco.Core/Models/DictionaryItem.cs
+++ b/src/Umbraco.Core/Models/DictionaryItem.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
diff --git a/src/Umbraco.Core/Models/DictionaryTranslation.cs b/src/Umbraco.Core/Models/DictionaryTranslation.cs
index 51c7ff2800..afb4063b97 100644
--- a/src/Umbraco.Core/Models/DictionaryTranslation.cs
+++ b/src/Umbraco.Core/Models/DictionaryTranslation.cs
@@ -1,8 +1,6 @@
using System;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
-using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
@@ -50,7 +48,6 @@ namespace Umbraco.Core.Models
Key = uniqueId;
}
-
///
/// Gets or sets the for the translation
///
diff --git a/src/Umbraco.Core/Models/Entities/BeingDirty.cs b/src/Umbraco.Core/Models/Entities/BeingDirty.cs
index 4e6d0cf5e3..92b4ab5c4b 100644
--- a/src/Umbraco.Core/Models/Entities/BeingDirty.cs
+++ b/src/Umbraco.Core/Models/Entities/BeingDirty.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Reflection;
namespace Umbraco.Core.Models.Entities
{
@@ -19,7 +18,7 @@ namespace Umbraco.Core.Models.Entities
/// The type of the value.
/// The new value.
/// A reference to the value to set.
- /// The property selector.
+ /// The property name.
/// A comparer to compare property values.
public new void SetPropertyValueAndDetectChanges(T value, ref T valueRef, string propertyName, IEqualityComparer comparer = null)
{
diff --git a/src/Umbraco.Core/Models/Entities/BeingDirtyBase.cs b/src/Umbraco.Core/Models/Entities/BeingDirtyBase.cs
index d9db433217..a598ba1b3d 100644
--- a/src/Umbraco.Core/Models/Entities/BeingDirtyBase.cs
+++ b/src/Umbraco.Core/Models/Entities/BeingDirtyBase.cs
@@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models.Entities
@@ -143,7 +142,7 @@ namespace Umbraco.Core.Models.Entities
/// The type of the value.
/// The new value.
/// A reference to the value to set.
- /// The property selector.
+ /// The property name.
/// A comparer to compare property values.
protected void SetPropertyValueAndDetectChanges(T value, ref T valueRef, string propertyName, IEqualityComparer comparer = null)
{
diff --git a/src/Umbraco.Core/Models/Entities/EntityBase.cs b/src/Umbraco.Core/Models/Entities/EntityBase.cs
index ef90f5e28d..43837fa776 100644
--- a/src/Umbraco.Core/Models/Entities/EntityBase.cs
+++ b/src/Umbraco.Core/Models/Entities/EntityBase.cs
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics;
-using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models.Entities
diff --git a/src/Umbraco.Core/Models/Entities/TreeEntityBase.cs b/src/Umbraco.Core/Models/Entities/TreeEntityBase.cs
index b8243ed0a9..937d7ab0fc 100644
--- a/src/Umbraco.Core/Models/Entities/TreeEntityBase.cs
+++ b/src/Umbraco.Core/Models/Entities/TreeEntityBase.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models.Entities
diff --git a/src/Umbraco.Core/Models/File.cs b/src/Umbraco.Core/Models/File.cs
index 494dcbe6fc..845da4d053 100644
--- a/src/Umbraco.Core/Models/File.cs
+++ b/src/Umbraco.Core/Models/File.cs
@@ -1,9 +1,5 @@
using System;
-using System.IO;
-using System.Reflection;
using System.Runtime.Serialization;
-using System.Text;
-using Umbraco.Core.IO;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
diff --git a/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs b/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs
index 084db81f11..0eb53428d1 100644
--- a/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs
+++ b/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs
@@ -3,20 +3,14 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
-using System.Reflection;
-using System.Security.Claims;
-using System.Threading.Tasks;
using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
-using Umbraco.Core.Security;
namespace Umbraco.Core.Models.Identity
{
public class BackOfficeIdentityUser : IdentityUser, IdentityUserClaim>, IRememberBeingDirty
{
-
private string _email;
private string _userName;
private int _id;
@@ -419,9 +413,9 @@ namespace Umbraco.Core.Models.Identity
private static readonly DelegateEqualityComparer GroupsComparer = new DelegateEqualityComparer(
(groups, enumerable) => groups.Select(x => x.Alias).UnsortedSequenceEqual(enumerable.Select(x => x.Alias)),
groups => groups.GetHashCode());
+
private static readonly DelegateEqualityComparer StartIdsComparer = new DelegateEqualityComparer(
(groups, enumerable) => groups.UnsortedSequenceEqual(enumerable),
groups => groups.GetHashCode());
-
}
}
diff --git a/src/Umbraco.Core/Models/Language.cs b/src/Umbraco.Core/Models/Language.cs
index 3e4d189abb..7d5fda3e06 100644
--- a/src/Umbraco.Core/Models/Language.cs
+++ b/src/Umbraco.Core/Models/Language.cs
@@ -1,7 +1,5 @@
using System;
using System.Globalization;
-using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using System.Threading;
using Umbraco.Core.Configuration;
@@ -16,7 +14,6 @@ namespace Umbraco.Core.Models
[DataContract(IsReference = true)]
public class Language : EntityBase, ILanguage
{
-
private string _isoCode;
private string _cultureName;
private bool _isDefaultVariantLanguage;
@@ -27,7 +24,7 @@ namespace Umbraco.Core.Models
{
IsoCode = isoCode;
}
-
+
///
[DataMember]
public string IsoCode
diff --git a/src/Umbraco.Core/Models/Macro.cs b/src/Umbraco.Core/Models/Macro.cs
index 2f29ddecff..bc71d3dc2b 100644
--- a/src/Umbraco.Core/Models/Macro.cs
+++ b/src/Umbraco.Core/Models/Macro.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Strings;
@@ -99,22 +98,6 @@ namespace Umbraco.Core.Models
private List _addedProperties;
private List _removedProperties;
- private static readonly Lazy Ps = new Lazy();
-
- private class PropertySelectors
- {
- public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo(x => x.Alias);
- public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name);
- public readonly PropertyInfo UseInEditorSelector = ExpressionHelper.GetPropertyInfo(x => x.UseInEditor);
- public readonly PropertyInfo CacheDurationSelector = ExpressionHelper.GetPropertyInfo(x => x.CacheDuration);
- public readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo(x => x.CacheByPage);
- public readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo(x => x.CacheByMember);
- public readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo(x => x.DontRender);
- public readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo(x => x.MacroSource);
- public readonly PropertyInfo MacroTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.MacroType);
- public readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo(x => x.Properties);
- }
-
void PropertiesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(nameof(Properties));
diff --git a/src/Umbraco.Core/Models/MacroProperty.cs b/src/Umbraco.Core/Models/MacroProperty.cs
index 7e269ba635..62ba6a7a7d 100644
--- a/src/Umbraco.Core/Models/MacroProperty.cs
+++ b/src/Umbraco.Core/Models/MacroProperty.cs
@@ -1,8 +1,6 @@
using System;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
-using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Models
{
diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs
index 06f94b85aa..78d1cfafd5 100644
--- a/src/Umbraco.Core/Models/Member.cs
+++ b/src/Umbraco.Core/Models/Member.cs
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Composing;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Logging;
-using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
{
@@ -130,7 +126,7 @@ namespace Umbraco.Core.Models
_rawPasswordValue = rawPasswordValue;
IsApproved = isApproved;
}
-
+
///
/// Gets or sets the Username
///
diff --git a/src/Umbraco.Core/Models/MemberGroup.cs b/src/Umbraco.Core/Models/MemberGroup.cs
index 69e26c1037..8c06da418d 100644
--- a/src/Umbraco.Core/Models/MemberGroup.cs
+++ b/src/Umbraco.Core/Models/MemberGroup.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
@@ -17,7 +16,6 @@ namespace Umbraco.Core.Models
private string _name;
private int _creatorId;
-
///
[DataMember]
[DoNotClone]
diff --git a/src/Umbraco.Core/Models/MemberType.cs b/src/Umbraco.Core/Models/MemberType.cs
index 141cb3b63c..a6c1518446 100644
--- a/src/Umbraco.Core/Models/MemberType.cs
+++ b/src/Umbraco.Core/Models/MemberType.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
diff --git a/src/Umbraco.Core/Models/Membership/UserGroup.cs b/src/Umbraco.Core/Models/Membership/UserGroup.cs
index 0562586af4..31421f990d 100644
--- a/src/Umbraco.Core/Models/Membership/UserGroup.cs
+++ b/src/Umbraco.Core/Models/Membership/UserGroup.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Strings;
diff --git a/src/Umbraco.Core/Models/MigrationEntry.cs b/src/Umbraco.Core/Models/MigrationEntry.cs
index 1149f6c773..1af66d2978 100644
--- a/src/Umbraco.Core/Models/MigrationEntry.cs
+++ b/src/Umbraco.Core/Models/MigrationEntry.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using Semver;
using Umbraco.Core.Models.Entities;
diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs
index f7f45d7f5c..726ddc1cf5 100644
--- a/src/Umbraco.Core/Models/Property.cs
+++ b/src/Umbraco.Core/Models/Property.cs
@@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Collections;
using Umbraco.Core.Models.Entities;
@@ -25,8 +24,6 @@ namespace Umbraco.Core.Models
// _vvalues contains the (indexed) variant property values
private Dictionary _vvalues;
- private static readonly Lazy Ps = new Lazy();
-
///
/// Initializes a new instance of the class.
///
@@ -100,29 +97,25 @@ namespace Umbraco.Core.Models
=> new PropertyValue { _culture = _culture, _segment = _segment, PublishedValue = PublishedValue, EditedValue = EditedValue };
}
- // ReSharper disable once ClassNeverInstantiated.Local
- private class PropertySelectors
- {
- public readonly DelegateEqualityComparer