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(QueryIsOfExpression expression)
        {
            CodeExpression    argument = this.GenerateCode(expression.Source);
            CodeTypeReference type     = this.GetTypeReference(expression.TypeToOperateAgainst);

            return(argument.TypeIs(type));
        }
Beispiel #2
0
        /// <summary>
        /// Evaluates the specified expression.
        /// </summary>
        /// <param name="expression">The expression to evaluate.</param>
        /// <returns>Value of the expression.</returns>
        public QueryValue Visit(QueryIsOfExpression expression)
        {
            QueryValue source     = this.Evaluate(expression.Source);
            QueryType  resultType = expression.TypeToOperateAgainst;

            return(source.IsOf(resultType, false));
        }
        /// <summary>
        /// Replaces the given expression.
        /// </summary>
        /// <param name="expression">Expression to replace.</param>
        /// <returns>Replaced expression.</returns>
        public virtual QueryExpression Visit(QueryIsOfExpression expression)
        {
            var source = this.ReplaceExpression(expression.Source);

            if (this.HasChanged(expression.Source, source))
            {
                return(source.IsOf(expression.TypeToOperateAgainst));
            }

            return(expression);
        }
            /// <summary>
            /// Visits a QueryExpression tree whose root node is the QueryCastExpression.
            /// </summary>
            /// <param name="expression">The root node of the expression tree being visited.</param>
            /// <returns>Uri query string representing the expression.</returns>
            public override string Visit(QueryIsOfExpression expression)
            {
                string argument       = this.Convert(expression.Source);
                string edmTypeLiteral = this.GetEdmTypeName(expression.TypeToOperateAgainst);

                if (string.IsNullOrEmpty(argument))
                {
                    return(string.Format(CultureInfo.InvariantCulture, "isof('{0}')", edmTypeLiteral));
                }

                return(string.Format(CultureInfo.InvariantCulture, "isof({0}, '{1}')", argument, edmTypeLiteral));
            }
            /// <summary>
            /// Visits a QueryExpression tree whose root node is the QueryCastExpression.
            /// </summary>
            /// <param name="expression">The root node of the expression tree being visited.</param>
            /// <returns>Uri query string representing the expression.</returns>
            public override string Visit(QueryIsOfExpression expression)
            {
                string argument = this.Convert(expression.Source);
                string edmTypeLiteral = this.GetEdmTypeName(expression.TypeToOperateAgainst);
                if (string.IsNullOrEmpty(argument))
                {
                    return string.Format(CultureInfo.InvariantCulture, "isof('{0}')", edmTypeLiteral);
                }

                return string.Format(CultureInfo.InvariantCulture, "isof({0}, '{1}')", argument, edmTypeLiteral);
            }
Beispiel #6
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the QueryIsOfExpression.
 /// </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(QueryIsOfExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
        /// <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(QueryIsOfExpression expression)
        {
            var source = this.ResolveTypes(expression.Source);

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