WCF 数据服务覆盖选择数据

发布于 2024-10-08 03:22:38 字数 368 浏览 3 评论 0原文

我刚刚观看了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一指流沙 2024-10-15 03:22:38

每个实体集获取都可以被所谓的拦截器拦截。看看它们,看看这是否是您想要做的。拦截器允许您拦截对实体集的调用并执行一些自定义逻辑。一探究竟

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文