Esempio n. 1
0
        /// <summary>
        /// Processes the expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="db">The db.</param>
        /// <param name="definition">The view definition.</param>
        /// <returns></returns>
        public ExpressionVisitor ProcessExpression(Expression expression, CouchDatabase db, CouchViewDefinition definition)
        {
            Query = db.Query(definition);
            VisitExpression(expression);

            switch (keys.Count)
            {
                case 0: // 0 keys means it's a range query. do nothing.
                    break;
                case 1: // 1 key means it's a single Equals or a Contains on a single.
                    Query.Key(keys[0]);
                    break;
                default: // neither 0 nor 1 means that we've got a set of keys to test.
                    Query.Keys(keys);
                    break;
            }

            return this;
        }
Esempio n. 2
0
 /// <summary>
 /// Processes the expression.
 /// </summary>
 /// <param name="expression">The expression.</param>
 /// <param name="db">The db.</param>
 /// <param name="design">The name of the design document.</param>
 /// <param name="view">The name of the view.</param>
 /// <returns></returns>
 public ExpressionVisitor ProcessExpression(Expression expression, CouchDatabase db, string design, string view)
 {
     Query = db.Query(design, view);
     VisitExpression(expression);
     return this;
 }