protected override ISqlFragment buildWhereFragment(IMartenSession session) { if (WhereClauses.Count == 0) { return(_storage.DefaultWhereFragment()); } var parser = new WhereClauseParser(session, this); ISqlFragment where = null; switch (WhereClauses.Count) { case 0: where = _storage.DefaultWhereFragment(); break; case 1: where = parser.Build(WhereClauses.Single()); break; default: var wheres = WhereClauses.Select(x => parser.Build(x)).ToArray(); where = new CompoundWhereFragment("and", wheres); break; } return(_storage.FilterDocuments(null, where)); }
protected override IWhereFragment buildWhereFragment(MartenExpressionParser parser) { if (WhereClauses.Count == 0) { return(_storage.DefaultWhereFragment()); } var where = WhereClauses.Count == 1 ? parser.ParseWhereFragment(Fields, WhereClauses.Single().Predicate) : new CompoundWhereFragment(parser, Fields, "and", WhereClauses); return(_storage.FilterDocuments(null, where)); }
protected override IWhereFragment buildWhereFragment(MartenExpressionParser parser) { // TODO -- this logic is duplicated. Pull it into a helper somewhere. // Find the duplication of DefaultWhereFragment/ FilterDocuments in other places if (WhereClauses.Count == 0) { return(_storage.DefaultWhereFragment()); } var where = WhereClauses.Count == 1 ? parser.ParseWhereFragment(Fields, WhereClauses.Single().Predicate) : new CompoundWhereFragment(parser, Fields, "and", WhereClauses); return(_storage.FilterDocuments(null, where)); }
protected virtual IWhereFragment buildWhereFragment(MartenExpressionParser parser) { return(WhereClauses.Count == 1 ? parser.ParseWhereFragment(Fields, WhereClauses.Single().Predicate) : new CompoundWhereFragment(parser, Fields, "and", WhereClauses)); }