Skip to content

Commit

Permalink
Fixed cache pollution for in/nin filter expressions (#6711)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolai-mb authored and michaelstaib committed Dec 11, 2023
1 parent b3e8374 commit efcd136
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -60,11 +61,14 @@ public static Expression In(
Type genericType,
object? parsedValue)
{
var enumerableType = typeof(IEnumerable<>);
var enumerableGenericType = enumerableType.MakeGenericType(genericType);

return Expression.Call(
typeof(Enumerable),
nameof(Enumerable.Contains),
new Type[] { genericType },
Expression.Constant(parsedValue),
CreateParameter(parsedValue, enumerableGenericType),
property);
}

Expand Down

0 comments on commit efcd136

Please sign in to comment.