I am trying to add OData v4 query support to a method on a controller that inherits from ApiController, not ODataController. Although I have a working OData model in the solution, there are some endpoints that don't actually belong to the model, but the usefulness of the query would be useful.
I have seen some articles suggesting that I simply return IQueryable and use EnableQuery.
Here is my sample code:
public class TestController : ApiController
{
[HttpGet]
[EnableQuery]
public IQueryable<TestObject> Events()
{
var result = new[] { new TestObject { Id = "1" } }.AsQueryable();
return result;
}
}
public class TestObject
{
public string Id { get; set; }
}
, , // - 406, -, OData, , , OData. (, , ) , , .
- , , ?
406?
EDIT:
, , , ODataMediaTypeFormatter .
.
, , WebApi - , 406, .