Example #1
0
        protected internal virtual Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
        {
            ReadOnlyCollection <Expression> args = Visit(sqlFunction.Arguments);

            if (args != sqlFunction.Arguments)
            {
                return(new SqlTableValuedFunctionExpression(sqlFunction.SqlFunction, sqlFunction.ViewTable, sqlFunction.SingleColumnType, sqlFunction.Alias, args));
            }
            return(sqlFunction);
        }
Example #2
0
        protected internal override Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
        {
            ReadOnlyCollection <Expression> args = Visit(sqlFunction.Arguments, a => MakeSqlValue(Visit(a)));

            if (args != sqlFunction.Arguments)
            {
                return(new SqlTableValuedFunctionExpression(sqlFunction.SqlFunction, sqlFunction.Table, sqlFunction.Alias, args));
            }
            return(sqlFunction);
        }
Example #3
0
        protected internal override Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
        {
            ReadOnlyCollection <Expression> args = Visit(sqlFunction.Arguments);
            Alias newAlias = aliasMap.TryGetC(sqlFunction.Alias) ?? sqlFunction.Alias;

            if (args != sqlFunction.Arguments || sqlFunction.Alias != newAlias)
            {
                return(new SqlTableValuedFunctionExpression(sqlFunction.SqlFunction, sqlFunction.ViewTable, sqlFunction.SingleColumnType, newAlias, args));
            }
            return(sqlFunction);
        }
Example #4
0
        protected internal override Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
        {
            var columns = CurrentScope.Keys.Where(ce => ce.Alias == sqlFunction.Alias).ToList();

            CurrentScope.SetRange(columns, columns.Cast <Expression>());

            ReadOnlyCollection <Expression> args = Visit(sqlFunction.Arguments);

            if (args != sqlFunction.Arguments)
            {
                return(new SqlTableValuedFunctionExpression(sqlFunction.SqlFunction, sqlFunction.Table, sqlFunction.Alias, args));
            }
            return(sqlFunction);
        }
Example #5
0
        protected internal override Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
        {
            sb.Append(sqlFunction.SqlFunction);
            sb.Append("(");
            for (int i = 0, n = sqlFunction.Arguments.Count; i < n; i++)
            {
                Expression exp = sqlFunction.Arguments[i];
                if (i > 0)
                {
                    sb.Append(", ");
                }
                this.Visit(exp);
            }
            sb.Append(")");

            return(sqlFunction);
        }
Example #6
0
 private bool CompareTableValuedSqlFunction(SqlTableValuedFunctionExpression a, SqlTableValuedFunctionExpression b)
 {
     return(a.ViewTable == b.ViewTable &&
            CompareAlias(a.Alias, b.Alias) &&
            CompareList(a.Arguments, b.Arguments, Compare));
 }
Example #7
0
 protected internal override Expression VisitSqlTableValuedFunction(SqlTableValuedFunctionExpression sqlFunction)
 {
     this.aliases.Add(sqlFunction.Alias);
     return(base.VisitSqlTableValuedFunction(sqlFunction));
 }