oData-将过滤器应用于SQL查询 [英] oData - applying filters to SQL queries

查看:74
本文介绍了oData-将过滤器应用于SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对oData服务还比较陌生,我正在尝试探索oData对于我的项目是否可行.

I am relatively new to oData service and I am trying to explore if oData is feasible for my project.

从我遇到的所有示例/演示中,每个演示总是将所有数据加载到存储库中,然后对数据应用oData过滤器.

From all the examples / demos that I have come across,every demo always loads up all data into the repository and then oData filters are applied over the data.

有没有一种方法可以不从SQL加载所有数据(将过滤器从oData应用于SQL),这显然对于每秒传入N个请求来说效率很低?

Is there a way to not load up all data (apply the filters to SQL from oData) from SQL which will obviously be highly inefficient for N number of requests coming in /second ?

例如,如果我有电影服务:

So for example if I had a movies service :

localhost:4502/OdataService/movies(55)

localhost:4502/OdataService/movies(55)

上面的示例实际上只是从一组整个"电影中过滤电影ID55.是否有一种方法可以使此过滤器在SQL级别发生,而不是首先使所有电影占用内存,然后允许oData进行过滤它吗?

The above example is actually just filtering for movie id 55 from an "entire" set of movies.Is there a way to make this filter happen at SQL level instead of bloating the memory first with all movies and then allowing oData to filter it?

有人可以引导我朝正确的方向前进吗?

Can anyone guide me in the right direction?

推荐答案

我做了一个小的POC之后发现,实体框架负责根据请求构建动态查询.

I found out after doing a small POC that Entity framework takes care of building dynamic query based on the request.

这篇关于oData-将过滤器应用于SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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