Skip to content

Commit 47756e0

Browse files
committed
PoC for avoiding client eval
1 parent c1b49e6 commit 47756e0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Microsoft.AspNet.OData.Shared/Query/Expressions/AggregationBinder.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,16 +402,16 @@ private Expression CreatePropertyAggregateExpression(ParameterExpression accum,
402402
// we need cast it to IEnumerable<baseType> during expression building (IEnumerable)$it
403403
// however for EF6 we need to use $it.AsQueryable() due to limitations in types of casts that will properly translated
404404
Expression asQuerableExpression = null;
405-
if (ClassicEF)
406-
{
405+
//if (ClassicEF)
406+
//{
407407
var asQuerableMethod = ExpressionHelperMethods.QueryableAsQueryable.MakeGenericMethod(baseType);
408408
asQuerableExpression = Expression.Call(null, asQuerableMethod, accum);
409-
}
410-
else
411-
{
412-
var queryableType = typeof(IEnumerable<>).MakeGenericType(baseType);
413-
asQuerableExpression = Expression.Convert(accum, queryableType);
414-
}
409+
//}
410+
//else
411+
//{
412+
// var queryableType = typeof(IEnumerable<>).MakeGenericType(baseType);
413+
// asQuerableExpression = Expression.Convert(accum, queryableType);
414+
//}
415415

416416
// $count is a virtual property, so there's not a propertyLambda to create.
417417
if (expression.Method == AggregationMethod.VirtualPropertyCount)
@@ -586,6 +586,7 @@ private IQueryable BindGroupBy(IQueryable query)
586586
// .GroupBy($it => new NoGroupByWrapper())
587587
groupLambda = Expression.Lambda(Expression.New(this._groupByClrType), this.LambdaParameter);
588588
}
589+
589590

590591
return ExpressionHelpers.GroupBy(query, groupLambda, elementType, this._groupByClrType);
591592
}

0 commit comments

Comments
 (0)