OData $filter with items in a $expand

后端 未结 4 1964
花落未央
花落未央 2020-12-08 14:14

I have given some web services to access informations.

The first thing that i have tries to expand a node . And i have done that successfully with following code

4条回答
  •  自闭症患者
    2020-12-08 14:43

    In OData the Filter command only works on the top level element. For your filter to work you would need to have the following URL

    http://www.example.com/ODataService/WorkService.svc/CaseStudies(x)/ServiceOfferings?format=json&$filter=ServiceOfferingID eq 127

    Obviously this isn't the query you are trying to write, but behind the scenes your query is being converted to an expression tree which has a root expression based on the top level element.

    If you really required to filter the data you could potentially intercept the query and write your own expression as below:

    [QueryInterceptor("CaseStudies")]
    public Expression> CaseStudieFilter()
    {
        
    }
    

提交回复
热议问题