Skip to content

Commit

Permalink
Use new BCL HashCode class
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Aug 7, 2019
1 parent 778a785 commit 534d407
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
11 changes: 1 addition & 10 deletions src/EFCore.PG/Infrastructure/Internal/NpgsqlOptionsExtension.cs
Expand Up @@ -367,16 +367,7 @@ public class UserRangeDefinition : IEquatable<UserRangeDefinition>
}

public override int GetHashCode()
{
unchecked
{
var hashCode = RangeName.GetHashCode();
hashCode = (hashCode * 397) ^ (SchemaName?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ SubtypeClrType.GetHashCode();
hashCode = (hashCode * 397) ^ (SubtypeName?.GetHashCode() ?? 0);
return hashCode;
}
}
=> HashCode.Combine(RangeName, SchemaName, SubtypeClrType, SubtypeName);

public override bool Equals(object obj) => obj is UserRangeDefinition urd && Equals(urd);

Expand Down
@@ -1,4 +1,5 @@
using System.Linq.Expressions;
using System;
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal;
Expand Down Expand Up @@ -40,13 +41,7 @@ bool Equals(NpgsqlCompiledQueryCacheKey other)
=> _relationalCompiledQueryCacheKey.Equals(other._relationalCompiledQueryCacheKey)
&& _reverseNullOrdering == other._reverseNullOrdering;

public override int GetHashCode()
{
unchecked
{
return (_relationalCompiledQueryCacheKey.GetHashCode() * 397) ^ _reverseNullOrdering.GetHashCode();
}
}
public override int GetHashCode() => HashCode.Combine(_relationalCompiledQueryCacheKey, _reverseNullOrdering);
}
}
}

0 comments on commit 534d407

Please sign in to comment.