@@ -577,7 +577,10 @@ Expression ParseIn()
577
577
var typeArgs = new [ ] { left . Type } ;
578
578
args = new [ ] { right , left } ;
579
579
580
- accumulate = Expression . Call ( typeof ( Enumerable ) , containsSignature . Name , typeArgs , args ) ;
580
+ var enumerableType = typeof ( Enumerable ) ;
581
+ if ( ! typeof ( IQueryable ) . IsAssignableFrom ( right . Type ) )
582
+ enumerableType = typeof ( Queryable ) ;
583
+ accumulate = Expression . Call ( enumerableType , containsSignature . Name , typeArgs , args ) ;
581
584
}
582
585
else
583
586
throw ParseError ( op . Pos , Res . OpenParenOrIdentifierExpected ) ;
@@ -1518,7 +1521,7 @@ Expression ParseMemberAccess(Type type, Expression instance)
1518
1521
if ( enumerableType != null )
1519
1522
{
1520
1523
Type elementType = enumerableType . GetTypeInfo ( ) . GetGenericTypeArguments ( ) [ 0 ] ;
1521
- return ParseAggregate ( instance , elementType , id , errorPos ) ;
1524
+ return ParseAggregate ( instance , elementType , id , errorPos , FindGenericType ( typeof ( IQueryable < > ) , type ) != null ) ;
1522
1525
}
1523
1526
}
1524
1527
@@ -1625,7 +1628,7 @@ Type FindType(string name)
1625
1628
return null ;
1626
1629
}
1627
1630
1628
- Expression ParseAggregate ( Expression instance , Type elementType , string methodName , int errorPos )
1631
+ Expression ParseAggregate ( Expression instance , Type elementType , string methodName , int errorPos , bool isQueryable )
1629
1632
{
1630
1633
var oldParent = _parent ;
1631
1634
@@ -1701,7 +1704,7 @@ Expression ParseAggregate(Expression instance, Type elementType, string methodNa
1701
1704
}
1702
1705
}
1703
1706
1704
- return Expression . Call ( typeof ( Enumerable ) , signature . Name , typeArgs , args ) ;
1707
+ return Expression . Call ( isQueryable ? typeof ( Queryable ) : typeof ( Enumerable ) , signature . Name , typeArgs , args ) ;
1705
1708
}
1706
1709
1707
1710
Expression [ ] ParseArgumentList ( )
0 commit comments