예제 #1
0
        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));
        }
예제 #2
0
        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));
        }