//[EnableQuery] public IActionResult Get(ODataQueryOptions <Customer> queryOptions) { if (queryOptions.Filter != null) { var model = EdmModelBuilder.GetEdmModel2(); IEdmEntitySet entitySet = model.EntityContainer.FindEntitySet("Customers"); EntitySetSegment segment = new EntitySetSegment(entitySet); ODataPath path = new ODataPath(segment); // Request.ODataFeature().Model = model; // if you have these codes, the output is different // Request.ODataFeature().Path = path; ODataQueryContext context = new ODataQueryContext(model, typeof(Customer), path); // I hard code the rawValue, you should retrieve the filter clause from queryOptions to construct the it. string rawValue = "contains(CustomMetadata, 'CustomPropA')"; ODataQueryOptionParser parser = new ODataQueryOptionParser(model, path, new Dictionary <string, string> { { "$filter", rawValue } }); FilterQueryOption filter = new FilterQueryOption(rawValue, context, parser); return(Ok(filter.ApplyTo(_context.Customers, new ODataQuerySettings()))); } return(Ok(_context.Customers)); }