This project is read-only.

Custom Filters

I realize that I can't support every possible method of querying so I provide two ways for you to specify your own filters. There's the Filter class and FilterWith method. You can also use the overload of Where, but it only calls FilterWith under the covers. FilterWith is like any other Where clause so it can be chained with other conditions:

var filterWith = context.Query<User>()
    .Select(u => u)
var filterWith = context.Query<User>()
    .Where(u => u.Title == "Unknown")

var filterWith = context.Query<User>()

var query = context.Query<User>()
    .Where(u => u.FirstName == "John" && Filter.Equal(u, "sn", "Doe"));
var query = context.Query<User>()
    .Where(u => u.FirstName != "John" && !Filter.EqualAny(u, "sn", new [] {"Doe", "Smith"}));

The Filter class has the following methods:
  • Equal
  • Approximately
  • StartsWith
  • EndsWith
  • Like
  • GreaterThanOrEqual
  • GreaterThan
  • LessThanOrEqual
  • LessThan
  • EqualAny
  • EqualAnything
  • MatchingRule

Last edited Jun 11, 2012 at 6:28 AM by MadHatter22, version 5