Skip to content

Commit

Permalink
Tiny: Add InExpression argument check
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Dec 9, 2019
1 parent f765b9d commit 313983d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/EFCore.Relational/Query/SqlExpressions/InExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
public virtual InExpression Negate() => new InExpression(Item, !IsNegated, Values, Subquery, TypeMapping);

public virtual InExpression Update(SqlExpression item, SqlExpression values, SelectExpression subquery)
=> item != Item || subquery != Subquery || values != Values
{
if (values != null
&& subquery != null)
{
throw new ArgumentException($"Either {nameof(values)} or {nameof(subquery)} must be null");
}

return item != Item || subquery != Subquery || values != Values
? new InExpression(item, IsNegated, values, subquery, TypeMapping)
: this;
}

public override void Print(ExpressionPrinter expressionPrinter)
{
Expand Down

0 comments on commit 313983d

Please sign in to comment.