尝试访问传递到IQueryable实现程序中的表达式 [英] Trying to access the Expression passed into an IQueryable implementor

查看:107
本文介绍了尝试访问传递到IQueryable实现程序中的表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建实现IQueryable的存储库.客户端按如下方式调用此存储库:

I am creating a Repository that implements IQueryable. The client calls this Repository as follows:

OrderRepository.AsQueryable().Where(x => x.ID == 123);



因此,据我了解,IQueryable的要点是允许实现者在获取数据/实体之前访问传递给它的表达式.

例如,使用上面的代码,OrderRepository会知道要从ID = 123的数据源执行特定的提取.

如果没有AsQueryable,OrderRepository将需要获取所有订单,然后客户端将应用Where函数来将完整的Orders结果集过滤为仅ID = 123的那些订单.

我现在的主要问题是我似乎在通过存储库访问表达式时遇到问题.

我对此的理解正确吗?我可能会缺少什么?



So the point of IQueryable as I understand it is that is allows the implementor to access the expression being passed to it before fetching the data/entities.

For example, with the code above, OrderRepository would know to perform a specific fetch from it''s datasource where ID=123.

Without AsQueryable the OrderRepository would need to fetch all orders and *then* the Where function would be applied by the client to filter the full Orders result set down to only those orders where ID=123.

My main problem right now is I seem to be having problems accessing the expression through the Repository.

Is my understanding of this correct? What might I be missing?

推荐答案

http ://stackoverflow.com/questions/1578778/using-iqueryable-with-linq [ ^ ]

此链接应有助于回答您的一些问题.
http://stackoverflow.com/questions/1578778/using-iqueryable-with-linq[^]

This link should help answer some of your questions.


这篇关于尝试访问传递到IQueryable实现程序中的表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆