Feedback on ASP.NET Web API

Add a fluent OData query configuration API

In the current release of OData Web API, security for queries is applied via the Queryable attribute or via ODataQueryOptions. The current system lacks any built-in method for restricting which fields can be used with the $filter query option. Implementing a trivial list of fields that support $filter is difficult, given that it can apply to relations.

Instead, consider adding a "fluent" configuration API that captures this information at the entity level and allows orderby & filter to be "entity model aware" (for lack of a better term).

For example,
var settingsBuilder = ODataConventionSettingsBuilder();
settingsBuilder.Entity<Order>().OrderByProperties("Id");
settingsBuilder.Entity<Order>()
.OrderByProperties({ "Id", "Name" })
.FilterProperties({ "Id" });

The benefit here is that the settings are stored as a single graph that can be traversed when relations are used. Alternately, the QueryableAttribute applied to controllers & query actions can be pulled out and analyzed as a graph, but its very limiting in enterprise scenarios (no inheritance, difficult to extend, etc)

20 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base