Feedback on ASP.NET Web API

OData string transform to .NET types

Consider having the following string OData query string:

$filter=(Name eq 'bla)&$skip=5

Would be awesome if you can get the lambda function of $filter. Aswell things like skip, sort field and order, etc.

This would be useful for creating a specific AJAX handler which would filter out a dataset, create Observable data streams (Signalr), etc...

Would be cool if we can extend this parser (get the AST and override parts of the Visitor pattern applied to build an Expression).
Why would you not satisified with only $filter -> Func<T, bool>? Well other collections like (Nhibernate) like to do filtering on a specific way.

Having only Func<T, bool> as output for $filter would make it too specific.

5 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Mark de Jong shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Mark de Jong commented  ·   ·  Flag as inappropriate

    That's nice, haven't seen that yet..! I have to dig into that, but from my first impression it's really specific to WebApi. Would be great if i can mix it up in a light weight SignalR PersistentConnection (aka Observable stream of events) w/o mixing WebApi :)

  • Alex James commented  ·   ·  Flag as inappropriate

    This is already possible using ODataQueryOptions.

    Hanging off ODataQueryOptions is a Filter property which in turn holds a Node which is an AST representing the $filter. You could easily translate this to whatever query language you want directly. We simply provide the binding to Func<T,bool> as a convenience for what is a very common scenario.

    See this for more:

Feedback and Knowledge Base