Using an IQueryable in another IQueryable

后端 未结 1 1114

I\'ve an extension method, which returns an IQueryable, to get company products, I just want to use it in a IQueryable as a subquery,

public static class DBEntit         


        
相关标签:
1条回答
  • 2021-01-22 21:16

    Problem is not IQueryable inside IQueryable, because you can include subqueries just not the way you did.

    In your example whole Select is represented as expression tree. In that expression tree there is something like :

    CALL method DBEntitiesCompanyExtensions.GetCompanyProducts
    

    Now EF should somehow traslate this into SQL SELECT statement. It cannot do that, because it cannot "look inside" GetCompanyProducts method and see what is going on there. Nor can it execute this method and do anything with it's result. The fact it returns IQueryable does not help and is not related.

    0 讨论(0)
提交回复
热议问题