Skip to content

Commit

Permalink
Updated to return constant hash codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Dec 17, 2021
1 parent e167674 commit 4f7c38c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ public AliasUniquifier(HashSet<string> usedAliases)

private sealed class TableReferenceExpression : Expression
{
private int? _hashCode;
private SelectExpression _selectExpression;

public TableReferenceExpression(SelectExpression selectExpression, string alias)
Expand Down Expand Up @@ -393,15 +392,7 @@ private bool Equals(TableReferenceExpression tableReferenceExpression)

/// <inheritdoc />
public override int GetHashCode()
{
// ReSharper disable NonReadonlyMemberInGetHashCode
// Ensure hashcode does not change after it has been created for this object.
Check.DebugAssert(
_hashCode == null || _hashCode == HashCode.Combine(Alias),
"Hashed value has mutated.");

return _hashCode ??= HashCode.Combine(Alias);
}
=> 0;
}

private sealed class ConcreteColumnExpression : ColumnExpression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace Microsoft.EntityFrameworkCore.Query.SqlExpressions;
/// </summary>
public abstract class TableExpressionBase : Expression, IPrintableExpression
{
private int? _hashCode;

/// <summary>
/// Creates a new instance of the <see cref="TableExpressionBase" /> class.
/// </summary>
Expand Down Expand Up @@ -64,13 +62,5 @@ private bool Equals(TableExpressionBase tableExpressionBase)

/// <inheritdoc />
public override int GetHashCode()
{
// ReSharper disable NonReadonlyMemberInGetHashCode
// Ensure hashcode does not change after it has been created for this object.
Check.DebugAssert(
_hashCode == null || _hashCode == HashCode.Combine(Alias),
"Hashed value has mutated.");

return _hashCode ??= HashCode.Combine(Alias);
}
=> 0;
}

0 comments on commit 4f7c38c

Please sign in to comment.