Using Odata to get huge amount of data

我是研究僧i 提交于 2019-12-12 00:45:40

问题


I have a data source provider :

public class DSProvider
    {
        public IQueryable<Product> Products
        {
            get
            {
                return _repo.Products.AsQueryable();
            }
        }
}

The repository in the above example currently gets ALL the records (of Products) from DB and then applies the filters, this just does not sound right if you had 50000 requests/sec from a website.How can you limit the repository to just return required info from DB without converting the service to a tightly coupled request option i.e. opposite of what you try to achieve by using oData?

So to summarize I would like to know if its possible to query the DB on the oData options supplied by the user so that my request does not always have to get all products and then apply filters of oData.


回答1:


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



来源:https://stackoverflow.com/questions/17974634/using-odata-to-get-huge-amount-of-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!