Implementation of the Filtering API of Microsoft Guidelines REST API using Superpower.
- Equal
var expression = "Id eq 1";
- NotEqual
var expression = "Id ne 1";
- GraterThan
var expression = "Id gt 1";
- GraterThanOrEqual
var expression = "Id ge 1";
- LessThan
var expression = "Id lt 1";
- LessThanOrEqual
var expression = "Id le 1";
- In
var expression = "Id in (1,2,3)";
- Length
var expression = "length(Title) gt 1";
- StartsWith
var expression = "startswith(Title, 'Some')";
- EndsWith
var expression = "endswith(Title, 'Title')";
- Contains
var expression = "contains(Title, 'Title')";
- IndexOf
var expression = "indexof(Title, 'Title') eq 0";
- And
var expression = "Id eq 1 and Value ne 5.0";
- Or
var expression = "Id eq 1 or Value ne 5.0";
- Not
var expression = "not Id eq 1";
var expression = "(length(Title) gt 5 and contains(Title, 'tle')) or Id in (3,5)";
// Parse a filtering function
Expression<Func<Item, bool>> predicateExpression = FilterParser.Parse<Item>(expression);
// Compile a filtering function
Func<Item, bool> predicate = FilterCompiler.Compile<Item>(expression);