Where is it correct/incorrect to apply the EnableQueryAttribute as of Jan 2015?
The document linked below:
Says:
The [EnableQuery] attribute enables clients to modify the query, by using query options such as $filter, $sort, and $page. For more information, see Supporting OData Query Options.
The following linked document:
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/supporting-odata-query-options
Says:
The EnableQuerySupport method enables query options globally for any controller action that returns an IQueryable type.
But this document for OData 4 on WebApi 2.2 has put it on actions returning IHttpActionResult:
[ODataRoutePrefix("Teams")]
public class TeamsEntitySetController : ODataController
{
private readonly LeageContext _leage = new LeageContext();
[EnableQuery]
[ODataRoute]
public IHttpActionResult GetFeed()
{
return Ok(_leage.Teams);
}
[ODataRoute("({id})")]
[EnableQuery]
public IHttpActionResult GetEntity(int id)
{
return Ok(SingleResult.Create<Team>(_leage.Teams.Where(t => t.Id == id)));
}
}
I'm going crazy trying to find up-to-date, accurate and consistent documentation on OData v4 / WebApi 2.2.
Which is correct today?