Declare custom $filter functions
Currently, OData supports $filter=Round(rating) eq 300
This translates to a linq query similar to Math.Round(t.rating) == 300
I would like to be able to define functions in the svc.cs file which accept the AST that will be executed, and apply custom constraints.. hence I could define any functions. For example the URI "service.svc?$filter=IsLeapYear(CustomerYearOfBirth)" would map to the C# method
public static Expression<Func<Customer, bool>> IsLeapYear(Expression<IQueryable<Customer>> tasks, DateTime date, Expression<Func<Customer, int>> member)
.. that static method would manipulate the AST - in some simple way. This would be analogous to how you can sequentially manipulate an IQueryable, adding new constraints as separate statements, then execution evaluates all the constraints.
Adam Langley commented
[EDIT] Manipulating the AST, rather than simply implementing logic in C#, means that if you function can be passed on to the Linq query provider, it will be compiled into SQL, and hence execute much more quickly by the database engine.