@@ -264,7 +264,7 @@ private Expression VisitLock(MethodCallExpression expression)
264
264
var newDataSource = visitedSource . ItemProjector . DataSource . Lock ( lockMode , lockBehavior ) ;
265
265
var newItemProjector = new ItemProjectorExpression (
266
266
visitedSource . ItemProjector . Item , newDataSource , visitedSource . ItemProjector . Context ) ;
267
- var projectionExpression = visitedSource . Apply ( newItemProjector ) ;
267
+ var projectionExpression = visitedSource . ApplyItemProjector ( newItemProjector ) ;
268
268
return projectionExpression ;
269
269
}
270
270
@@ -290,11 +290,7 @@ private Expression VisitTag(MethodCallExpression expression)
290
290
: visitedSource . ItemProjector . DataSource ;
291
291
var newItemProjector = new ItemProjectorExpression (
292
292
visitedSource . ItemProjector . Item , newDataSource , visitedSource . ItemProjector . Context ) ;
293
- var projectionExpression = new ProjectionExpression (
294
- visitedSource . Type ,
295
- newItemProjector ,
296
- visitedSource . TupleParameterBindings ,
297
- visitedSource . ResultAccessMethod ) ;
293
+ var projectionExpression = visitedSource . ApplyItemProjector ( newItemProjector ) ;
298
294
return projectionExpression ;
299
295
}
300
296
@@ -349,7 +345,7 @@ private ProjectionExpression VisitCast(Expression source, Type targetType, Type
349
345
350
346
var visitedSource = VisitSequence ( source ) ;
351
347
var itemProjector = visitedSource . ItemProjector . EnsureEntityIsJoined ( ) ;
352
- var projection = visitedSource . Apply ( itemProjector ) ;
348
+ var projection = visitedSource . ApplyItemProjector ( itemProjector ) ;
353
349
if ( targetType == sourceType ) {
354
350
return projection ;
355
351
}
@@ -772,14 +768,14 @@ private Expression VisitAggregate(Expression source, MethodInfo method, LambdaEx
772
768
groupingDataSource . GroupColumnIndexes ,
773
769
( IReadOnlyList < AggregateColumnDescriptor > ) aggregateDescriptors ) ;
774
770
var optimizedItemProjector = groupingProjection . ItemProjector . Remap ( resultDataSource , 0 ) ;
775
- groupingProjection = groupingProjection . Apply ( optimizedItemProjector ) ;
771
+ groupingProjection = groupingProjection . ApplyItemProjector ( optimizedItemProjector ) ;
776
772
context . Bindings . ReplaceBound ( groupingParameter , groupingProjection ) ;
777
773
var isSubqueryParameter = State . OuterParameters . Contains ( groupingParameter ) ;
778
774
if ( isSubqueryParameter ) {
779
775
var newApplyParameter = context . GetApplyParameter ( resultDataSource ) ;
780
776
foreach ( var innerParameter in State . Parameters ) {
781
777
var projectionExpression = context . Bindings [ innerParameter ] ;
782
- var newProjectionExpression = projectionExpression . Apply ( projectionExpression . ItemProjector . RewriteApplyParameter ( groupingFilterParameter , newApplyParameter ) ) ;
778
+ var newProjectionExpression = projectionExpression . ApplyItemProjector ( projectionExpression . ItemProjector . RewriteApplyParameter ( groupingFilterParameter , newApplyParameter ) ) ;
783
779
context . Bindings . ReplaceBound ( innerParameter , newProjectionExpression ) ;
784
780
}
785
781
}
@@ -1048,7 +1044,7 @@ private ProjectionExpression VisitGroupBy(Type returnType, Expression source, La
1048
1044
} ) ;
1049
1045
1050
1046
var filter = FastExpression . Lambda ( filterBody , tupleParameter ) ;
1051
- var subqueryProjection = sequence . Apply ( new ItemProjectorExpression (
1047
+ var subqueryProjection = sequence . ApplyItemProjector ( new ItemProjectorExpression (
1052
1048
sequence . ItemProjector . Item ,
1053
1049
groupingSourceProjection . ItemProjector . DataSource . Filter ( ( Expression < Func < Tuple , bool > > ) filter ) ,
1054
1050
context ) ) ;
@@ -1240,7 +1236,7 @@ private Expression VisitGroupJoin(Expression outerSource, Expression innerSource
1240
1236
newGroupingExpression ,
1241
1237
innerGrouping . ItemProjector . DataSource ,
1242
1238
innerGrouping . ItemProjector . Context ) ;
1243
- innerGrouping = innerGrouping . Apply ( newGroupingItemProjector ) ;
1239
+ innerGrouping = innerGrouping . ApplyItemProjector ( newGroupingItemProjector ) ;
1244
1240
}
1245
1241
1246
1242
var groupingKeyPropertyInfo = groupingType . GetProperty ( WellKnown . KeyFieldName ) ;
@@ -1328,7 +1324,7 @@ private ProjectionExpression VisitSelectMany(Expression source, LambdaExpression
1328
1324
innerItemProjector = innerItemProjector . SetDefaultIfEmpty ( ) ;
1329
1325
}
1330
1326
1331
- innerProjection = projection . Apply ( innerItemProjector ) ;
1327
+ innerProjection = projection . ApplyItemProjector ( innerItemProjector ) ;
1332
1328
}
1333
1329
1334
1330
var outerProjection = context . Bindings [ outerParameter ] ;
@@ -1348,7 +1344,7 @@ private ProjectionExpression VisitSelectMany(Expression source, LambdaExpression
1348
1344
1349
1345
var resultProjection = CombineProjections ( outerProjection , innerProjection , recordSet , resultSelector ) ;
1350
1346
var resultItemProjector = resultProjection . ItemProjector . RemoveOuterParameter ( ) ;
1351
- resultProjection = resultProjection . Apply ( resultItemProjector ) ;
1347
+ resultProjection = resultProjection . ApplyItemProjector ( resultItemProjector ) ;
1352
1348
return resultProjection ;
1353
1349
}
1354
1350
}
@@ -1513,7 +1509,7 @@ private Expression VisitExistsAsInclude(Expression source, LambdaExpression pred
1513
1509
. Include ( State . IncludeAlgorithm , true , rawProvider . Source , context . GetNextAlias ( ) , filteredColumns ) ;
1514
1510
1515
1511
var newItemProjector = outerResult . ItemProjector . Remap ( newDataSource , 0 ) ;
1516
- var newOuterResult = outerResult . Apply ( newItemProjector ) ;
1512
+ var newOuterResult = outerResult . ApplyItemProjector ( newItemProjector ) ;
1517
1513
context . Bindings . ReplaceBound ( outerParameter , newOuterResult ) ;
1518
1514
Expression resultExpression = ColumnExpression . Create ( WellKnownTypes . Bool , columnIndex ) ;
1519
1515
if ( notExists ) {
@@ -1698,7 +1694,7 @@ private ProjectionExpression VisitSequence(Expression sequenceExpression, Expres
1698
1694
if ( result != null ) {
1699
1695
var projectorExpression = result . ItemProjector . EnsureEntityIsJoined ( ) ;
1700
1696
if ( projectorExpression != result . ItemProjector ) {
1701
- result = result . Apply ( projectorExpression ) ;
1697
+ result = result . ApplyItemProjector ( projectorExpression ) ;
1702
1698
}
1703
1699
1704
1700
return result ;
0 commit comments