Beispiel #1
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(LinqCastExpression expression)
        {
            CodeExpression    source = this.GenerateCode(expression.Source);
            CodeTypeReference type   = this.GetTypeReference(expression.TypeToOperateAgainst);

            return(source.Call("Cast", new CodeTypeReference[] { type }));
        }
Beispiel #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 virtual QueryExpression Visit(LinqCastExpression expression)
        {
            var argument = this.ReplaceExpression(expression.Source);

            if (this.HasChanged(expression.Source, argument))
            {
                return(argument.CastEnumerable(expression.TypeToOperateAgainst));
            }

            return(expression);
        }
Beispiel #3
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the LinqCastExpression.
 /// </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(LinqCastExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
        /// <summary>
        /// Evaluates the specified expression.
        /// </summary>
        /// <param name="expression">The expression to evaluate.</param>
        /// <returns>Value of the expression.</returns>
        public virtual QueryValue Visit(LinqCastExpression expression)
        {
            var source = this.EvaluateCollection(expression.Source);

            return(source.Cast(expression.TypeToOperateAgainst));
        }
        /// <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(LinqCastExpression expression)
        {
            var source = this.ResolveTypes(expression.Source);

            return(source.CastEnumerable(expression.TypeToOperateAgainst));
        }