internal override SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc)
 {
     foreach (SqlColumn c in fc.Columns)
     {
         c.Alias = this.alias;
     }
     return(base.VisitTableValuedFunctionCall(fc));
 }
Пример #2
0
 internal virtual SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc)
 {
     for (int i = 0, n = fc.Arguments.Count; i < n; i++)
     {
         fc.Arguments[i] = this.VisitExpression(fc.Arguments[i]);
     }
     return(fc);
 }
Пример #3
0
            internal override SqlAlias VisitAlias(SqlAlias a)
            {
                SqlTable tab = a.Node as SqlTable;
                SqlTableValuedFunctionCall tvf = a.Node as SqlTableValuedFunctionCall;

                if (this.addPrimaryKeys && (tab != null || tvf != null))
                {
                    List <SqlOrderExpression> list = new List <SqlOrderExpression>();

                    bool     isTable = tab != null;
                    MetaType rowType = isTable ? tab.RowType : tvf.RowType;
                    foreach (MetaDataMember mm in rowType.IdentityMembers)
                    {
                        string           name = mm.MappedName;
                        SqlColumn        col;
                        Expression       sourceExpression;
                        List <SqlColumn> columns;

                        if (isTable)
                        {
                            col = tab.Find(name);
                            sourceExpression = tab.SourceExpression;
                            columns          = tab.Columns;
                        }
                        else
                        {
                            col = tvf.Find(name);
                            sourceExpression = tvf.SourceExpression;
                            columns          = tvf.Columns;
                        }

                        if (col == null)
                        {
                            col       = new SqlColumn(mm.MemberAccessor.Type, typeProvider.From(mm.MemberAccessor.Type), name, mm, null, sourceExpression);
                            col.Alias = a;
                            columns.Add(col);
                        }
                        list.Add(new SqlOrderExpression(SqlOrderType.Ascending, new SqlColumnRef(col)));
                    }

                    this.PrependOrderExpressions(list);

                    return(a);
                }
                else
                {
                    return(base.VisitAlias(a));
                }
            }
Пример #4
0
 internal override SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc)
 {
     foreach (SqlColumn c in fc.Columns)
     {
         if (c == this.match)
         {
             if (this.found != null)
             {
                 throw Error.ColumnIsDefinedInMultiplePlaces(GetColumnName(this.match));
             }
             this.found = c;
             break;
         }
     }
     return(fc);
 }
            internal override SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc)
            {
                SqlExpression[] args = new SqlExpression[fc.Arguments.Count];
                for (int i = 0, n = fc.Arguments.Count; i < n; i++)
                {
                    args[i] = this.VisitExpression(fc.Arguments[i]);
                }
                SqlTableValuedFunctionCall nfc = new SqlTableValuedFunctionCall(fc.RowType, fc.ClrType, fc.SqlType, fc.Name, args, fc.SourceExpression);

                this.nodeMap[fc] = nfc;
                foreach (SqlColumn c in fc.Columns)
                {
                    nfc.Columns.Add((SqlColumn)this.Visit(c));
                }
                return(nfc);
            }
Пример #6
0
            internal override SqlExpression VisitTableValuedFunctionCall(SqlTableValuedFunctionCall fc)
            {
                var array = new SqlExpression[fc.Arguments.Count];
                var i     = 0;

                for (var count = fc.Arguments.Count; i < count; i++)
                {
                    array[i] = VisitExpression(fc.Arguments[i]);
                }
                var sqlTableValuedFunctionCall = new SqlTableValuedFunctionCall(fc.RowType, fc.ClrType, fc.SqlType, fc.Name, array, fc.SourceExpression);

                nodeMap[fc] = sqlTableValuedFunctionCall;
                foreach (var column in fc.Columns)
                {
                    sqlTableValuedFunctionCall.Columns.Add((SqlColumn)Visit(column));
                }
                return(sqlTableValuedFunctionCall);
            }