Only consider Id, but not ParentId for TreeNode equality checks
This commit is contained in:
parent
702fa89914
commit
e6fa2933b5
|
@ -4,9 +4,10 @@ namespace InnovEnergy.App.Backend.Model;
|
||||||
|
|
||||||
public abstract partial class TreeNode
|
public abstract partial class TreeNode
|
||||||
{
|
{
|
||||||
|
// Note: Only consider Id, but not ParentId for TreeNode equality checks
|
||||||
protected Boolean Equals(TreeNode other)
|
protected Boolean Equals(TreeNode other)
|
||||||
{
|
{
|
||||||
return Id == other.Id && ParentId == other.ParentId;
|
return Id == other.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Boolean Equals(Object? obj)
|
public override Boolean Equals(Object? obj)
|
||||||
|
@ -17,8 +18,5 @@ public abstract partial class TreeNode
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")]
|
[SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")]
|
||||||
public override Int32 GetHashCode()
|
public override Int32 GetHashCode() => Id.GetHashCode();
|
||||||
{
|
|
||||||
return HashCode.Combine(Id, ParentId);
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue