File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,9 @@ DbExpression Process_MemberAccess_Which_Link_First_Or_FirstOrDefault(MemberExpre
203
203
204
204
Type delegateType = typeof ( Func < , > ) . MakeGenericType ( parameter . Type , selectorBody . Type ) ;
205
205
LambdaExpression selector = Expression . Lambda ( delegateType , selectorBody , parameter ) ;
206
- var selectMethod = methodCall . Object . Type . GetMethod ( "Select" ) ;
206
+
207
+ Type queryType = ConvertToIQueryType ( methodCall . Object . Type ) ;
208
+ var selectMethod = queryType . GetMethod ( "Select" ) ;
207
209
selectMethod = selectMethod . MakeGenericMethod ( selectorBody . Type ) ;
208
210
var selectMethodCall = Expression . Call ( methodCall . Object , selectMethod , Expression . Quote ( selector ) ) ; /* query.Select(a=> a.xx.Name) */
209
211
@@ -282,6 +284,15 @@ static bool IsIQueryType(Type type)
282
284
implementedInterface = implementedInterface . GetGenericTypeDefinition ( ) ;
283
285
return queryType == implementedInterface ;
284
286
}
287
+ static Type ConvertToIQueryType ( Type type )
288
+ {
289
+ Type queryType = typeof ( IQuery < > ) ;
290
+ if ( queryType == type . GetGenericTypeDefinition ( ) )
291
+ return type ;
292
+
293
+ Type implementedInterface = type . GetInterface ( "IQuery`1" ) ;
294
+ return implementedInterface ;
295
+ }
285
296
286
297
static bool IsComeFrom_First_Or_FirstOrDefault ( MemberExpression exp )
287
298
{
You can’t perform that action at this time.
0 commit comments