Ejemplo n.º 1
0
        /// <summary>
        /// Called when visiting a &lt;Where/&gt; expression.
        /// </summary>
        /// <param name="expression">An instance of the <see cref="CamlWhereExpression"/> class representing the &lt;Where/&gt; expression.</param>
        /// <returns>When overriden, returns an expression to replace the expression given in arguments.</returns>
        protected virtual CamlExpression VisitWhereExpression(CamlWhereExpression expression)
        {
            CommonHelper.ConfirmNotNull(expression, "expression");
            CamlExpression bodyExpression = VisitChecked(expression.Body, CamlExpressionType.Where);

            if (bodyExpression != expression.Body)
            {
                switch (bodyExpression.Type)
                {
                case CamlExpressionType.WhereUnaryComparison:
                case CamlExpressionType.WhereBinaryComparison:
                case CamlExpressionType.WhereLogical:
                    return(new CamlWhereExpression((CamlWhereComparisonExpression)bodyExpression));

                case CamlExpressionType.Where:
                case CamlExpressionType.Empty:
                    return(bodyExpression);
                }
                throw new InvalidOperationException();
            }
            return(expression);
        }
Ejemplo n.º 2
0
 protected override CamlExpression VisitWhereExpression(CamlWhereExpression expression)
 {
     using (new WhereExpressionScope(this)) {
         return(base.VisitWhereExpression(expression));
     }
 }