@@ -479,24 +479,25 @@ protected override Expression VisitConditional(ConditionalExpression conditional
479
479
/// doing so can result in application failures when updating to a new Entity Framework Core release.
480
480
/// </summary>
481
481
protected override Expression VisitExtension ( Expression extensionExpression )
482
- {
483
- switch ( extensionExpression )
482
+ => extensionExpression switch
484
483
{
485
- case EntityProjectionExpression :
486
- case StructuralTypeReferenceExpression :
487
- return extensionExpression ;
484
+ EntityProjectionExpression or StructuralTypeReferenceExpression
485
+ => extensionExpression ,
488
486
489
- case StructuralTypeShaperExpression shaper :
490
- return new StructuralTypeReferenceExpression ( shaper ) ;
487
+ QueryParameterExpression queryParameter
488
+ => Expression . Call (
489
+ GetParameterValueMethodInfo . MakeGenericMethod ( queryParameter . Type ) ,
490
+ QueryCompilationContext . QueryContextParameter ,
491
+ Expression . Constant ( queryParameter . Name ) ) ,
491
492
492
- case ProjectionBindingExpression projectionBindingExpression :
493
- return ( ( InMemoryQueryExpression ) projectionBindingExpression . QueryExpression )
494
- . GetProjection ( projectionBindingExpression ) ;
493
+ StructuralTypeShaperExpression shaper
494
+ => new StructuralTypeReferenceExpression ( shaper ) ,
495
495
496
- default :
497
- return QueryCompilationContext . NotTranslatedExpression ;
498
- }
499
- }
496
+ ProjectionBindingExpression projectionBindingExpression
497
+ => ( ( InMemoryQueryExpression ) projectionBindingExpression . QueryExpression ) . GetProjection ( projectionBindingExpression ) ,
498
+
499
+ _ => QueryCompilationContext . NotTranslatedExpression
500
+ } ;
500
501
501
502
/// <summary>
502
503
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -988,17 +989,7 @@ protected override Expression VisitNewArray(NewArrayExpression newArrayExpressio
988
989
/// doing so can result in application failures when updating to a new Entity Framework Core release.
989
990
/// </summary>
990
991
protected override Expression VisitParameter ( ParameterExpression parameterExpression )
991
- {
992
- if ( parameterExpression . Name ? . StartsWith ( QueryCompilationContext . QueryParameterPrefix , StringComparison . Ordinal ) == true )
993
- {
994
- return Expression . Call (
995
- GetParameterValueMethodInfo . MakeGenericMethod ( parameterExpression . Type ) ,
996
- QueryCompilationContext . QueryContextParameter ,
997
- Expression . Constant ( parameterExpression . Name ) ) ;
998
- }
999
-
1000
- throw new InvalidOperationException ( CoreStrings . TranslationFailed ( parameterExpression . Print ( ) ) ) ;
1001
- }
992
+ => throw new InvalidOperationException ( CoreStrings . TranslationFailed ( parameterExpression . Print ( ) ) ) ;
1002
993
1003
994
/// <summary>
1004
995
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
0 commit comments