From 4f092a7ad3533c41e39b72c7f747f5a98c9fcf22 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Sun, 8 Dec 2019 15:48:49 +0100 Subject: [PATCH] Tiny: Add InExpression argument check --- src/EFCore.Relational/Query/SqlExpressions/InExpression.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/EFCore.Relational/Query/SqlExpressions/InExpression.cs b/src/EFCore.Relational/Query/SqlExpressions/InExpression.cs index a67454dc235..4839f974e0c 100644 --- a/src/EFCore.Relational/Query/SqlExpressions/InExpression.cs +++ b/src/EFCore.Relational/Query/SqlExpressions/InExpression.cs @@ -68,6 +68,12 @@ public virtual InExpression Update( { Check.NotNull(item, nameof(item)); + 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;