I am trying to enable OData in the Web Api class and adding the [Queryable] attribute to my query
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; public class ItemsController : ApiController { ... [HttpGet] [Queryable] public IQueryable<Item> GetItems() { return _repository.Items.AsQueryable(); }
but visual studio tells me
'Queryable' is not an attribute
and I get a compilation error:
CS0616: 'System.Linq.Queryable' is not an attribute class
If I qualify the attribute
[System.Web.Http.Queryable]
I get another error message
CS0234: The type or namespace name 'Queryable' does not exist in the namespace 'System.Web.Http' (do you miss the assembly reference?)
Any ideas why [Queryable] doesn't seem to be recognized? This is a web form application to which the web interface was added later.
source share