support for checking with case insensitivity. Example. CurrentPage.NewsItems where NewsItem is a child doc type alias. Found one reason why the old dynamic node has performance issues and have added a note, just need to do more reseearch to make sure my findings are correct. Changed over all of the new DynamicNode classes to be DynamicDocument instead.
43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Umbraco.Core.Dynamics
|
|
{
|
|
internal class Signature : IEquatable<Signature>
|
|
{
|
|
public DynamicProperty[] Properties { get; set; }
|
|
public int HashCode { get; set; }
|
|
|
|
public Signature(IEnumerable<DynamicProperty> properties)
|
|
{
|
|
this.Properties = properties.ToArray();
|
|
HashCode = 0;
|
|
foreach (DynamicProperty p in this.Properties)
|
|
{
|
|
HashCode ^= p.Name.GetHashCode() ^ p.Type.GetHashCode();
|
|
}
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is Signature && Equals((Signature)obj);
|
|
}
|
|
|
|
public bool Equals(Signature other)
|
|
{
|
|
if (Properties.Length != other.Properties.Length) return false;
|
|
for (int i = 0; i < Properties.Length; i++)
|
|
{
|
|
if (Properties[i].Name != other.Properties[i].Name ||
|
|
Properties[i].Type != other.Properties[i].Type) return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
} |