public static IWhereFragment BuildWhereFragment(this IDocumentSchema schema, IQueryableDocument mapping, QueryModel query) { var wheres = query.BodyClauses.OfType <WhereClause>().ToArray(); if (wheres.Length == 0) { return(mapping.DefaultWhereFragment()); } var where = wheres.Length == 1 ? schema.Parser.ParseWhereFragment(mapping, wheres.Single().Predicate) : new CompoundWhereFragment(schema.Parser, mapping, "and", wheres); return(mapping.FilterDocuments(where)); }
private IWhereFragment buildWhereFragment() { var bodies = bodyClauses(); var wheres = bodies.OfType <WhereClause>().ToArray(); if (wheres.Length == 0) { return(_mapping.DefaultWhereFragment()); } var where = wheres.Length == 1 ? _store.Parser.ParseWhereFragment(_mapping, wheres.Single().Predicate) : new CompoundWhereFragment(_store.Parser, _mapping, "and", wheres); return(_mapping.FilterDocuments(Model, where)); }