Skip to content

Commit 1dac465

Browse files
committed
Fix the usage of ParsingConfig in some methods in the DynamicQueryableExtensions class
1 parent 233881c commit 1dac465

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/System.Linq.Dynamic.Core/DynamicQueryableExtensions.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static bool All(this IQueryable source, ParsingConfig config, string pred
127127
Check.NotEmpty(predicate);
128128

129129
bool createParameterCtor = SupportsLinqToObjects(config, source);
130-
LambdaExpression lambda = DynamicExpressionParser.ParseLambda(createParameterCtor, source.ElementType, null, predicate, args);
130+
LambdaExpression lambda = DynamicExpressionParser.ParseLambda(config, createParameterCtor, source.ElementType, null, predicate, args);
131131

132132
return Execute<bool>(_AllPredicate, source, Expression.Quote(lambda));
133133
}
@@ -1430,7 +1430,7 @@ public static IQueryable OfType(this IQueryable source, Type type)
14301430
Check.NotNull(source);
14311431
Check.NotNull(type);
14321432

1433-
var optimized = OptimizeExpression(Expression.Call(null, _ofType.MakeGenericMethod(type), new[] { source.Expression }));
1433+
var optimized = OptimizeExpression(Expression.Call(null, _ofType.MakeGenericMethod(type), [source.Expression]));
14341434

14351435
return source.Provider.CreateQuery(optimized);
14361436
}
@@ -1806,7 +1806,7 @@ public static IQueryable<TResult> Select<TResult>(this IQueryable source, Parsin
18061806
var methodCallExpression = Expression.Call(
18071807
typeof(Queryable),
18081808
nameof(Queryable.Select),
1809-
new[] { source.ElementType, typeof(TResult) },
1809+
[source.ElementType, typeof(TResult)],
18101810
source.Expression,
18111811
Expression.Quote(lambda)
18121812
);
@@ -1849,7 +1849,7 @@ public static IQueryable Select(this IQueryable source, ParsingConfig config, Ty
18491849

18501850
var optimized = OptimizeExpression(Expression.Call(
18511851
typeof(Queryable), nameof(Queryable.Select),
1852-
new[] { source.ElementType, resultType },
1852+
[source.ElementType, resultType],
18531853
source.Expression, Expression.Quote(lambda)));
18541854

18551855
return source.Provider.CreateQuery(optimized);
@@ -1905,7 +1905,7 @@ public static IQueryable SelectMany(this IQueryable source, ParsingConfig config
19051905
{
19061906
Check.NotNull(source);
19071907
Check.NotNull(config);
1908-
Check.NotNull(resultType, nameof(resultType));
1908+
Check.NotNull(resultType);
19091909
Check.NotEmpty(selector);
19101910

19111911
return SelectManyInternal(source, config, resultType, selector, args);
@@ -1980,7 +1980,7 @@ public static IQueryable<TResult> SelectMany<TResult>(this IQueryable source, Pa
19801980
Check.NotEmpty(selector);
19811981

19821982
bool createParameterCtor = config.EvaluateGroupByAtDatabase || SupportsLinqToObjects(config, source);
1983-
LambdaExpression lambda = DynamicExpressionParser.ParseLambda(createParameterCtor, source.ElementType, null, selector, args);
1983+
LambdaExpression lambda = DynamicExpressionParser.ParseLambda(config, createParameterCtor, source.ElementType, null, selector, args);
19841984

19851985
//we have to adjust to lambda to return an IEnumerable<T> instead of whatever the actual property is.
19861986
Type inputType = source.Expression.Type.GetTypeInfo().GetGenericTypeArguments()[0];
@@ -2096,12 +2096,12 @@ public static IQueryable SelectMany(
20962096
ParameterExpression xParameter = ParameterExpressionHelper.CreateParameterExpression(source.ElementType, collectionParameterName, config.RenameEmptyParameterExpressionNames);
20972097
ParameterExpression yParameter = ParameterExpressionHelper.CreateParameterExpression(sourceLambdaResultType, resultParameterName, config.RenameEmptyParameterExpressionNames);
20982098

2099-
LambdaExpression resultSelectLambda = DynamicExpressionParser.ParseLambda(config, createParameterCtor, new[] { xParameter, yParameter }, null, resultSelector, resultSelectorArgs);
2099+
LambdaExpression resultSelectLambda = DynamicExpressionParser.ParseLambda(config, createParameterCtor, [xParameter, yParameter], null, resultSelector, resultSelectorArgs);
21002100
Type resultLambdaResultType = resultSelectLambda.Body.Type;
21012101

21022102
var optimized = OptimizeExpression(Expression.Call(
21032103
typeof(Queryable), nameof(Queryable.SelectMany),
2104-
new[] { source.ElementType, sourceLambdaResultType, resultLambdaResultType },
2104+
[source.ElementType, sourceLambdaResultType, resultLambdaResultType],
21052105
source.Expression, Expression.Quote(sourceSelectLambda), Expression.Quote(resultSelectLambda))
21062106
);
21072107

@@ -2134,7 +2134,7 @@ public static dynamic Single(this IQueryable source)
21342134
{
21352135
Check.NotNull(source);
21362136

2137-
var optimized = OptimizeExpression(Expression.Call(typeof(Queryable), nameof(Queryable.Single), new[] { source.ElementType }, source.Expression));
2137+
var optimized = OptimizeExpression(Expression.Call(typeof(Queryable), nameof(Queryable.Single), [source.ElementType], source.Expression));
21382138
return source.Provider.Execute(optimized)!;
21392139
}
21402140

@@ -2205,7 +2205,7 @@ public static dynamic SingleOrDefault(this IQueryable source)
22052205
{
22062206
Check.NotNull(source);
22072207

2208-
var optimized = OptimizeExpression(Expression.Call(typeof(Queryable), nameof(Queryable.SingleOrDefault), new[] { source.ElementType }, source.Expression));
2208+
var optimized = OptimizeExpression(Expression.Call(typeof(Queryable), nameof(Queryable.SingleOrDefault), [source.ElementType], source.Expression));
22092209
return source.Provider.Execute(optimized)!;
22102210
}
22112211

@@ -2566,15 +2566,15 @@ internal static IOrderedQueryable InternalThenBy(IOrderedQueryable source, Parsi
25662566
{
25672567
queryExpr = Expression.Call(
25682568
typeof(Queryable), dynamicOrdering.MethodName,
2569-
new[] { source.ElementType, dynamicOrdering.Selector.Type },
2569+
[source.ElementType, dynamicOrdering.Selector.Type],
25702570
queryExpr, Expression.Quote(Expression.Lambda(dynamicOrdering.Selector, parameters)));
25712571
}
25722572
else
25732573
{
25742574
var comparerGenericType = typeof(IComparer<>).MakeGenericType(dynamicOrdering.Selector.Type);
25752575
queryExpr = Expression.Call(
25762576
typeof(Queryable), dynamicOrdering.MethodName,
2577-
new[] { source.ElementType, dynamicOrdering.Selector.Type },
2577+
[source.ElementType, dynamicOrdering.Selector.Type],
25782578
queryExpr, Expression.Quote(Expression.Lambda(dynamicOrdering.Selector, parameters)),
25792579
Expression.Constant(comparer, comparerGenericType));
25802580
}

0 commit comments

Comments
 (0)