Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Mar 29, 2017
1 parent a7e7c94 commit b403876
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 344 deletions.
20 changes: 10 additions & 10 deletions src/EFCore.Relational/Query/Expressions/ExistsExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public class ExistsExpression : Expression
/// <summary>
/// Creates a new instance of a ExistsExpression..
/// </summary>
/// <param name="expression"> The subquery operand of the EXISTS expression. </param>
public ExistsExpression([NotNull] Expression expression)
/// <param name="subquery"> The subquery operand of the EXISTS expression. </param>
public ExistsExpression([NotNull] SelectExpression subquery)
{
Check.NotNull(expression, nameof(expression));
Check.NotNull(subquery, nameof(subquery));

Expression = expression;
Subquery = subquery;
}

/// <summary>
Expand All @@ -31,7 +31,7 @@ public ExistsExpression([NotNull] Expression expression)
/// <value>
/// The subquery operand of the EXISTS expression.
/// </value>
public virtual Expression Expression { get; }
public virtual SelectExpression Subquery { get; }

/// <summary>
/// Returns the node type of this <see cref="Expression" />. (Inherited from <see cref="Expression" />.)
Expand Down Expand Up @@ -74,10 +74,10 @@ protected override Expression Accept(ExpressionVisitor visitor)
/// </remarks>
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var expression = visitor.Visit(Expression);
var subquery = (SelectExpression)visitor.Visit(Subquery);

return expression != Expression
? new ExistsExpression(expression)
return subquery != Subquery
? new ExistsExpression(subquery)
: this;
}

Expand All @@ -103,14 +103,14 @@ public override bool Equals(object obj)
return obj.GetType() == GetType() && Equals((ExistsExpression)obj);
}

private bool Equals(ExistsExpression other) => Equals(Expression, other.Expression);
private bool Equals(ExistsExpression other) => Equals(Subquery, other.Subquery);

/// <summary>
/// Returns a hash code for this object.
/// </summary>
/// <returns>
/// A hash code for this object.
/// </returns>
public override int GetHashCode() => Expression.GetHashCode();
public override int GetHashCode() => Subquery.GetHashCode();
}
}
8 changes: 4 additions & 4 deletions src/EFCore.Relational/Query/Expressions/InExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ public override bool Equals(object obj)
}

private bool Equals(InExpression other)
{
return Operand.Equals(other.Operand) && Values.SequenceEqual(other.Values) && SubQuery.Equals(other.SubQuery);
}
=> Operand.Equals(other.Operand)
&& Values.SequenceEqual(other.Values)
&& SubQuery.Equals(other.SubQuery);

/// <summary>
/// Returns a hash code for this object.
Expand All @@ -202,6 +202,6 @@ public override int GetHashCode()
/// </summary>
/// <returns>A <see cref="String" /> representation of the Expression.</returns>
public override string ToString()
=> Operand + " IN (" + string.Join(", ", Values) + ")";
=> Operand + " IN (" + (Values != null ? string.Join(", ", Values) : SubQuery.ToString()) + ")";
}
}
151 changes: 0 additions & 151 deletions src/EFCore.Relational/Query/Expressions/ProjectStarExpression.cs

This file was deleted.

Loading

0 comments on commit b403876

Please sign in to comment.