简体   繁体   中英

OData filter is not working in my web api

I didn't create OData controller, instead, I just installed OData package and add EnableQuery attribute to the IQueryable action method. Here is my method

    [HttpGet]
    [Route("WoundLocations")]
    [EnableQuery]
    public IQueryable<WoundLocation> GetWoundArea()
    {
        return _lookupService.GetWoundLocation().AsQueryable();
    }

And I call the action with the following url

  http://dev-xxx.xxxx.com/lookup/WoundLocations?filter=Side eq '0'

The returned result still has all the records in that table. Any thoughts?

您在filter关键字之前缺少$ ,它应该像这样:

http://dev-xxx.xxxx.com/lookup/WoundLocations?$filter=Side eq '0'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM