diff --git a/backend/src/Squidex.Infrastructure/Reflection/SimpleEquals.cs b/backend/src/Squidex.Infrastructure/Reflection/SimpleEquals.cs index 63d928b21..b04cf7708 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/SimpleEquals.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/SimpleEquals.cs @@ -18,9 +18,16 @@ namespace Squidex.Infrastructure.Reflection public static class SimpleEquals { private static readonly ConcurrentDictionary Comparers = new ConcurrentDictionary(); + private static readonly HashSet SimpleTypes = new HashSet(); private static readonly DefaultComparer DefaultComparer = new DefaultComparer(); private static readonly NoopComparer NoopComparer = new NoopComparer(); + static SimpleEquals() + { + SimpleTypes.Add(typeof(string)); + SimpleTypes.Add(typeof(Uri)); + } + internal static IDeepComparer Build(Type type) { return BuildCore(type) ?? DefaultComparer; @@ -91,7 +98,7 @@ namespace Squidex.Infrastructure.Reflection private static bool IsSimpleType(Type type) { - return type.IsValueType || type == typeof(string); + return type.IsValueType || SimpleTypes.Contains(type); } private static bool IsEquatable(Type type) diff --git a/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs index fab1d637d..ef155d05e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs @@ -84,6 +84,12 @@ namespace Squidex.Infrastructure.Reflection TimeSpan.FromMilliseconds(123), TimeSpan.FromMilliseconds(55) }; + + yield return new object[] + { + new Uri("/url1", UriKind.Relative), + new Uri("/url2", UriKind.Relative), + }; } [Theory]