Пример #1
0
        /// <summary>
        /// Evaluates the specified expression.
        /// </summary>
        /// <param name="expression">The expression to evaluate.</param>
        /// <returns>Value of the expression.</returns>
        public QueryValue Visit(LinqLengthPropertyExpression expression)
        {
            var instance           = (QueryScalarValue)this.Evaluate(expression.Instance);
            var evaluationStrategy = instance.Type.EvaluationStrategy;

            // TODO: is this abstracted enough?
            return(evaluationStrategy.EvaluateBuiltInFunction(evaluationStrategy.IntegerType, "Edm", "Length", instance));
        }
Пример #2
0
        /// <summary>
        /// Replaces the given expression.
        /// </summary>
        /// <param name="expression">The root node of the expression tree being visited.</param>
        /// <returns>Replaced expression.</returns>
        public QueryExpression Visit(LinqLengthPropertyExpression expression)
        {
            var instance = this.ReplaceExpression(expression.Instance);

            if (this.HasChanged(expression.Instance, instance))
            {
                return(new LinqLengthPropertyExpression(instance, expression.ExpressionType));
            }
            else
            {
                return(expression);
            }
        }
Пример #3
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the LinqLengthPropertyExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Uri query string representing the expression.</returns>
 public virtual string Visit(LinqLengthPropertyExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
Пример #4
0
        /// <summary>
        /// Generates System.CodeDom.CodeExpression from the given expression.
        /// </summary>
        /// <param name="expression">Expression from which System.CodeDom.CodeExpression is generated.</param>
        /// <returns>Generated System.CodeDom.CodeExpression.</returns>
        public virtual CodeExpression Visit(LinqLengthPropertyExpression expression)
        {
            var instance = this.GenerateCode(expression.Instance);

            return(Code.Property(instance, "Length"));
        }
Пример #5
0
        /// <summary>
        /// Resolves types for the specified expression.
        /// </summary>
        /// <param name="expression">The expression to resolve types for.</param>
        /// <returns>Expression with resolved types.</returns>
        public QueryExpression Visit(LinqLengthPropertyExpression expression)
        {
            var instance = this.ResolveTypes(expression.Instance);

            return(new LinqLengthPropertyExpression(instance, this.EvaluationStrategy.IntegerType));
        }