WCF 数据服务覆盖选择数据
我刚刚观看了 Scott Hanselman 在 OData 上的视频,并被它震撼了。
我已经根据他的示例完成了自己的解决方案,我想覆盖默认的获取数据方法。我想做的是查看正在执行的查询,如果查询很简单,则覆盖 GetCustomers SP 调用,例如;
from c in Customers where c.customerid = 12
基本上我不想每次有人运行该服务时都从 SQL 获取所有表。任何想法都感激不尽。
I just watched Scott Hanselman's video on OData and was blown away by it.
I've done my own solution based on his example and I want to override the default Get Data methods. What I'd like to do is to look at the query which is being executed and override the GetCustomers SP call if the query is simple such as;
from c in Customers where c.customerid = 12
Basically I don't want to get all the table from SQL every time someone runs the service. Any ideas gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个实体集获取都可以被所谓的拦截器拦截。看看它们,看看这是否是您想要做的。拦截器允许您拦截对实体集的调用并执行一些自定义逻辑。一探究竟
Every entity set fetching can be intercepted by what is known as Interceptors. Take a look at them and see if thats what you are trying to do. The interceptors allow you to intercept the calls to the entity set and do some customized logics. Check it out