@@ -18,37 +18,38 @@ internal class ClosureAccessRewriter : ExpressionVisitor
1818 {
1919 private readonly CompiledQueryProcessingScope compiledQueryScope ;
2020
21- protected override Expression VisitUnknown ( Expression e )
22- {
23- return e ;
24- }
21+ protected override Expression VisitUnknown ( Expression e ) => e ;
2522
2623 protected override Expression VisitMemberAccess ( MemberExpression memberExpression )
2724 {
2825 if ( memberExpression . Type . IsOfGenericInterface ( WellKnownInterfaces . QueryableOfT )
29- && memberExpression . Expression != null
30- && memberExpression . Expression . NodeType == ExpressionType . Constant
31- && memberExpression . Member != null
26+ && memberExpression . Expression != null
27+ && memberExpression . Expression . NodeType == ExpressionType . Constant
28+ && memberExpression . Member != null
3229 && memberExpression . Member . ReflectedType . IsClosure ( )
33- && memberExpression . Member . MemberType == MemberTypes . Field ) {
30+ && memberExpression . Member . MemberType == MemberTypes . Field ) {
3431 var fieldInfo = ( FieldInfo ) memberExpression . Member ;
3532 if ( ! fieldInfo . FieldType . IsOfGenericType ( WellKnownOrmTypes . EntitySetOfT ) ) {
36- if ( compiledQueryScope != null )
37- throw new InvalidOperationException ( String . Format ( Strings . ExUnableToUseIQueryableXInQueryExecuteStatement , fieldInfo . Name ) ) ;
33+ if ( compiledQueryScope != null ) {
34+ throw new InvalidOperationException ( string . Format ( Strings . ExUnableToUseIQueryableXInQueryExecuteStatement ,
35+ fieldInfo . Name ) ) ;
36+ }
37+
3838 var constantValue = ( ( ConstantExpression ) memberExpression . Expression ) . Value ;
3939 var queryable = ( IQueryable ) fieldInfo . GetValue ( constantValue ) ;
40- if ( queryable . Expression . Type . IsOfGenericInterface ( WellKnownInterfaces . QueryableOfT ) )
40+ if ( queryable . Expression . Type . IsOfGenericInterface ( WellKnownInterfaces . QueryableOfT ) ) {
4141 return Visit ( queryable . Expression ) ;
42+ }
43+
4244 return queryable . Expression ;
4345 }
4446 }
47+
4548 return base . VisitMemberAccess ( memberExpression ) ;
4649 }
4750
48- public static Expression Rewrite ( Expression e , CompiledQueryProcessingScope compiledQueryScope )
49- {
50- return new ClosureAccessRewriter ( compiledQueryScope ) . Visit ( e ) ;
51- }
51+ public static Expression Rewrite ( Expression e , CompiledQueryProcessingScope compiledQueryScope ) =>
52+ new ClosureAccessRewriter ( compiledQueryScope ) . Visit ( e ) ;
5253
5354 // Constructors
5455
0 commit comments