Fix equality check on property group (#13133)
* Fix equality check on property group
Also fix circular reference on PropertyTypeCollection
(cherry picked from commit f64f634979)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
391bfb73e8
commit
7208f591c7
@@ -2,6 +2,7 @@ using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using Umbraco.Cms.Core.Models.Entities;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models;
|
||||
@@ -132,7 +133,7 @@ public class PropertyGroup : EntityBase, IEquatable<PropertyGroup>
|
||||
}
|
||||
|
||||
public bool Equals(PropertyGroup? other) =>
|
||||
base.Equals(other) || (other != null && Type == other.Type && Alias == other.Alias);
|
||||
base.Equals(other) || (other != null && Type == other.Type && Alias == other.Alias && Id == other.Id);
|
||||
|
||||
public override int GetHashCode() => (base.GetHashCode(), Type, Alias).GetHashCode();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PropertyTypeCollection : KeyedCollection<string, IPropertyType>, IN
|
||||
// This baseclass calling is needed, else compiler will complain about nullability
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsReadOnly => ((ICollection<IPropertyType>)this).IsReadOnly;
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
// 'new' keyword is required! we can explicitly implement ICollection<IPropertyType>.Add BUT since normally a concrete PropertyType type
|
||||
// is passed in, the explicit implementation doesn't get called, this ensures it does get called.
|
||||
|
||||
Reference in New Issue
Block a user