示例#1
0
 internal virtual SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     for (int i = 0, n = suq.Arguments.Count; i < n; i++) {
         suq.Arguments[i] = this.VisitExpression(suq.Arguments[i]);
     }
     suq.Projection = this.VisitExpression(suq.Projection);
     for (int i = 0, n = suq.Columns.Count; i < n; i++) {
         suq.Columns[i] = (SqlUserColumn) this.Visit(suq.Columns[i]);
     }
     return suq;
 }
示例#2
0
        internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq)
        {
            bool saveTop = this.topLevel;

            this.topLevel = false;
            for (int i = 0, n = suq.Arguments.Count; i < n; i++)
            {
                suq.Arguments[i] = this.VisitParameter(suq.Arguments[i]);
            }
            this.topLevel  = saveTop;
            suq.Projection = this.VisitExpression(suq.Projection);
            return(suq);
        }
        internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq)
        {
            List <SqlExpression> args = new List <SqlExpression>(suq.Arguments.Count);

            foreach (SqlExpression expr in suq.Arguments)
            {
                args.Add(this.VisitExpression(expr));
            }
            SqlExpression projection = this.VisitExpression(suq.Projection);
            SqlUserQuery  n          = new SqlUserQuery(suq.QueryText, projection, args, suq.SourceExpression);

            this.nodeMap[suq] = n;

            foreach (SqlUserColumn suc in suq.Columns)
            {
                SqlUserColumn dupSuc = new SqlUserColumn(suc.ClrType, suc.SqlType, suc.Query, suc.Name, suc.IsRequired, suc.SourceExpression);
                this.nodeMap[suc] = dupSuc;
                n.Columns.Add(dupSuc);
            }

            return(n);
        }
 internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     if (suq.Arguments.Count > 0) {
         // compute all the arg values...
         StringBuilder savesb = this.sb;
         this.sb = new StringBuilder();
         object[] args = new object[suq.Arguments.Count];
         for (int i = 0, n = args.Length; i < n; i++) {
             this.Visit(suq.Arguments[i]);
             args[i] = this.sb.ToString();
             this.sb.Length = 0;
         }
         this.sb = savesb;
         // append query with args...
         sb.Append(string.Format(CultureInfo.InvariantCulture, suq.QueryText, args));
     } else {
         sb.Append(suq.QueryText);
     }
     return suq;
 }
 internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     this.canJoin = false;
     return base.VisitUserQuery(suq);
 }
            internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
                List<SqlExpression> args = new List<SqlExpression>(suq.Arguments.Count);
                foreach (SqlExpression expr in suq.Arguments) {
                    args.Add(this.VisitExpression(expr));
                }
                SqlExpression projection = this.VisitExpression(suq.Projection);
                SqlUserQuery n = new SqlUserQuery(suq.QueryText, projection, args, suq.SourceExpression);
                this.nodeMap[suq] = n;

                foreach (SqlUserColumn suc in suq.Columns) {
                    SqlUserColumn dupSuc = new SqlUserColumn(suc.ClrType, suc.SqlType, suc.Query, suc.Name, suc.IsRequired, suc.SourceExpression);
                    this.nodeMap[suc] = dupSuc;
                    n.Columns.Add(dupSuc);
                }

                return n;
            }
示例#7
0
        private SqlUserQuery VisitUserQuery(string query, Expression[] arguments, Type resultType) {
            SqlExpression[] args = new SqlExpression[arguments.Length];
            for (int i = 0, n = args.Length; i < n; i++) {
                args[i] = this.VisitExpression(arguments[i]);
            }
            SqlUserQuery suq = new SqlUserQuery(query, null, args, this.dominatingExpression);
            if (resultType != typeof(void)) {
                Type elementType = TypeSystem.GetElementType(resultType);
                MetaType mType = this.services.Model.GetMetaType(elementType);

                // if the element type is a simple type (int, bool, etc.) we create
                // a single column binding
                if (TypeSystem.IsSimpleType(elementType)) {
                    SqlUserColumn col = new SqlUserColumn(elementType, typeProvider.From(elementType), suq, "", false, this.dominatingExpression);
                    suq.Columns.Add(col);
                    suq.Projection = col;
                }
                else {
                    // ... otherwise we generate a default projection
                    SqlUserRow rowExp = new SqlUserRow(mType.InheritanceRoot, this.typeProvider.GetApplicationType((int)ConverterSpecialTypes.Row), suq, this.dominatingExpression);
                    suq.Projection = this.translator.BuildProjection(rowExp, mType, this.allowDeferred, null, this.dominatingExpression);
                }
            }
            return suq;
        }
示例#8
0
 internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     this.disableInclude = true;
     return base.VisitUserQuery(suq);
 }
 internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq)
 {
     this.canJoin = false;
     return(base.VisitUserQuery(suq));
 }
示例#10
0
 internal virtual SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     for (int i = 0, n = suq.Arguments.Count; i < n; i++) {
         suq.Arguments[i] = this.VisitExpression(suq.Arguments[i]);
     }
     suq.Projection = this.VisitExpression(suq.Projection);
     for (int i = 0, n = suq.Columns.Count; i < n; i++) {
         suq.Columns[i] = (SqlUserColumn) this.Visit(suq.Columns[i]);
     }
     return suq;
 }
 internal override SqlUserQuery VisitUserQuery(SqlUserQuery suq) {
     bool saveTop = this.topLevel;
     this.topLevel = false;
     for (int i = 0, n = suq.Arguments.Count; i < n; i++) {
         suq.Arguments[i] = this.VisitParameter(suq.Arguments[i]);
     }
     this.topLevel = saveTop;
     suq.Projection = this.VisitExpression(suq.Projection);
     return suq;
 }