当前位置: 首页>>代码示例>>C#>>正文


C# ColumnExpression类代码示例

本文整理汇总了C#中ColumnExpression的典型用法代码示例。如果您正苦于以下问题:C# ColumnExpression类的具体用法?C# ColumnExpression怎么用?C# ColumnExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ColumnExpression类属于命名空间,在下文中一共展示了ColumnExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddOuterJoinTest

 public virtual ProjectionExpression AddOuterJoinTest(ProjectionExpression proj)
 {
     var test = this.GetOuterJoinTest(proj.Select);
     var select = proj.Select;
     ColumnExpression testCol = null;
     // look to see if test expression exists in columns already
     foreach (var col in select.Columns)
     {
         if (test.Equals(col.Expression))
         {
             var colType = SqlType.Get(test.Type);
             testCol = new ColumnExpression(test.Type, colType, select.Alias, col.Name);
             break;
         }
     }
     if (testCol == null)
     {
         // add expression to projection
         testCol = test as ColumnExpression;
         string colName = (testCol != null) ? testCol.Name : "Test";
         colName = proj.Select.Columns.GetAvailableColumnName(colName);
         var colType = SqlType.Get(test.Type);
         select = select.AddColumn(new ColumnDeclaration(colName, test, colType));
         testCol = new ColumnExpression(test.Type, colType, select.Alias, colName);
     }
     var newProjector = new OuterJoinedExpression(testCol, proj.Projector);
     return new ProjectionExpression(select, newProjector, proj.Aggregator);
 }
开发者ID:jaykizhou,项目名称:elinq,代码行数:28,代码来源:DbExpressionBuilder.cs

示例2: GroupByExpression

 public GroupByExpression(ColumnExpression simpleGroup, Expression keyExpression)
     : base(ExpressionType, simpleGroup.Table)
 {
     SimpleGroup = simpleGroup;
     HasKey = false;
     KeyExpression = keyExpression;
     Table = SimpleGroup.Table;
 }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:GroupByExpression.cs

示例3: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     if (this.oldAliases.Contains(column.Alias))
     {
         return new ColumnExpression(column.Type, column.SqlType, this.newAlias, column.Name);
     }
     return column;
 }
开发者ID:nikhel,项目名称:elinq,代码行数:8,代码来源:ColumnMapper.cs

示例4: UpdateColumnAssignment

 protected ColumnAssignment UpdateColumnAssignment(ColumnAssignment ca, ColumnExpression c, Expression e)
 {
     if (c != ca.Column || e != ca.Expression)
     {
         return new ColumnAssignment(c, e);
     }
     return ca;
 }
开发者ID:bisand,项目名称:NetCouch,代码行数:8,代码来源:DbExpressionVisitor.cs

示例5: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     TableAlias newAlias;
     if (this.map.TryGetValue(column.Alias, out newAlias))
     {
         return new ColumnExpression(column.Type, newAlias, column.Name);
     }
     return column;
 }
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:9,代码来源:QueryDuplicator.cs

示例6: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     if (column.Alias != null)
     {
         sb.AppendFormat("`{0}`", GetAliasName(column.Alias));
         sb.Append(".");
     }
     sb.AppendFormat("`{0}`", column.Name);
     return column;
 }
开发者ID:6nop,项目名称:SubSonic-3.0,代码行数:10,代码来源:SQLiteFormatter.cs

示例7: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     if (column.Alias != null)
     {
         sb.AppendFormat("{0}", GetAliasName(column.Alias));
         sb.Append("."); //MAA,20091127:  remove quotes in column names
         //sb.Append(".\"");
     }
     sb.AppendFormat("{0}", column.Name);
     //sb.Append("\"");//MAA,20091127:  remove quotes in column names
     return column;
 }
开发者ID:mabraham1,项目名称:LINQ2Oracle,代码行数:12,代码来源:OracleFormatter.cs

示例8: VisitSelect

		protected override Expression VisitSelect(SelectExpression select)
		{
			select = (SelectExpression)base.VisitSelect(select);
			if (select.Skip != null)
			{
				SelectExpression newSelect = select.SetSkip(null).SetTake(null);
				bool canAddColumn = !select.IsDistinct && (select.GroupBy == null || select.GroupBy.Count == 0);
				if (!canAddColumn)
				{
					newSelect = newSelect.AddRedundantSelect(new TableAlias());
				}

				var colType = DbTypeSystem.GetColumnType(typeof(int));
				newSelect = newSelect.AddColumn(new ColumnDeclaration(columnName, new RowNumberExpression(select.OrderBy), colType));

				// add layer for WHERE clause that references new rownum column
				newSelect = newSelect.AddRedundantSelect(new TableAlias());
				newSelect = newSelect.RemoveColumn(newSelect.Columns.Single(c => c.Name == columnName));

				var newAlias = ((SelectExpression)newSelect.From).Alias;
				ColumnExpression rnCol = new ColumnExpression(typeof(int), colType, newAlias, columnName);
				Expression where;

				if (select.Take != null)
				{
					where = new BetweenExpression(
						rnCol, Expression.Add(select.Skip, Expression.Constant(1)), Expression.Add(select.Skip, select.Take));
				}
				else
				{
					where = rnCol.GreaterThan(select.Skip);
				}

				if (newSelect.Where != null)
				{
					where = newSelect.Where.And(where);
				}

				newSelect = newSelect.SetWhere(where);

				select = newSelect;
			}

			return select;
		}
开发者ID:mattleibow,项目名称:Mono.Data.Sqlite.Orm.Linq,代码行数:45,代码来源:SkipToRowNumberRewriter.cs

示例9: WriteColumnExpression

        public override bool WriteColumnExpression(ColumnExpression node)
        {
            if (ResolveNames)
            {
                Expression ex = node.FindDescendant<Expression>();
                WriteNode(ex);
                if (!String.IsNullOrEmpty(node.ColumnReference.ColumnAlias))
                {
                    Writer.Write(" AS {0}", QuoteIdentifier(node.ColumnReference.ColumnAlias));
                }

                return false;
            }
            else
            {
                return true;
            }
        }
开发者ID:horvatferi,项目名称:graywulf,代码行数:18,代码来源:MySqlCodeGenerator.cs

示例10: VisitSelect

        protected override Expression VisitSelect(SelectExpression select)
        {
            select = (SelectExpression) base.VisitSelect(select);

            // look for redundant column declarations
            List<ColumnDeclaration> cols = select.Columns.OrderBy(c => c.Name).ToList();
            BitArray removed = new BitArray(select.Columns.Count);
            bool anyRemoved = false;
            for (int i = 0, n = cols.Count; i < n - 1; i++)
            {
                ColumnDeclaration ci = cols[i];
                ColumnExpression cix = ci.Expression as ColumnExpression;
                QueryType qt = cix != null ? cix.QueryType : ci.QueryType;
                ColumnExpression cxi = new ColumnExpression(ci.Expression.Type, qt, select.Alias, ci.Name);
                for (int j = i + 1; j < n; j++)
                {
                    if (!removed.Get(j))
                    {
                        ColumnDeclaration cj = cols[j];
                        if (SameExpression(ci.Expression, cj.Expression))
                        {
                            // any reference to 'j' should now just be a reference to 'i'
                            ColumnExpression cxj = new ColumnExpression(cj.Expression.Type, qt, select.Alias, cj.Name);
                            this.map.Add(cxj, cxi);
                            removed.Set(j, true);
                            anyRemoved = true;
                        }
                    }
                }
            }
            if (anyRemoved)
            {
                List<ColumnDeclaration> newDecls = new List<ColumnDeclaration>();
                for (int i = 0, n = cols.Count; i < n; i++)
                {
                    if (!removed.Get(i))
                    {
                        newDecls.Add(cols[i]);
                    }
                }
                select = select.SetColumns(newDecls);
            }
            return select;
        }
开发者ID:lepigocher,项目名称:iqtoolkit-oracle,代码行数:44,代码来源:RedundantColumnRemover.cs

示例11: MakeSubquery

        private Expression MakeSubquery(Expression expression)
        {
            var newAlias = new TableAlias();
            var aliases = DeclaredAliasGatherer.Gather(expression);

            var decls = new List<ColumnDeclaration>();
            foreach (var ta in aliases) 
            {
                foreach (var col in this.columns[ta])
                {
                    string name = decls.GetAvailableColumnName(col.Name);
                    var decl = new ColumnDeclaration(name, col, col.QueryType);
                    decls.Add(decl);
                    var newCol = new ColumnExpression(col.Type, col.QueryType, newAlias, col.Name);
                    this.map.Add(col, newCol);
                }
            }

            return new SelectExpression(newAlias, decls, expression, null);
        }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:20,代码来源:CrossJoinIsolator.cs

示例12: ResolveColumn

        private ColumnExpression ResolveColumn(ColumnExpression ce, SelectExpression select)
        {
            if (ce.Alias == select.Alias)
            {
                var cd = select.Columns.SingleEx(a => a.Name == ce.Name);

                var result = cd.Expression as ColumnExpression;

                if(result == null)
                    return ce;

                TableExpression table = (TableExpression)select.From;

                if (table.Alias == result.Alias)
                {
                    return new ColumnExpression(result.Type, aliasGenerator.Table(table.Name), result.Name);
                }

                return result;
            }

            return ce;
        }
开发者ID:signumsoftware,项目名称:framework,代码行数:23,代码来源:UpdateDeleteSimplifier.cs

示例13: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     if (column.Alias != null && !this.HideColumnAliases)
     {
         this.WriteAliasName(GetAliasName(column.Alias));
         this.Write(".");
     }
     this.WriteColumnName(column.Name);
     return column;
 }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:10,代码来源:SqlFormatter.cs

示例14: VisitColumn

        protected virtual Expression VisitColumn(ColumnExpression column)
        {
            int iAlias;
            string aliasName =
                this.aliasMap.TryGetValue(column.Alias, out iAlias)
                ? "A" + iAlias
                : "A" + (column.Alias != null ? column.Alias.GetHashCode().ToString() : "") + "?";

            this.Write(aliasName);
            this.Write(".");
            this.Write("Column(\"");
            this.Write(column.Name);
            this.Write("\")");
            return column;
        }
开发者ID:nikhel,项目名称:elinq,代码行数:15,代码来源:DbExpressionWriter.cs

示例15: VisitColumn

 protected override Expression VisitColumn(ColumnExpression column)
 {
     MarkColumnAsUsed(column.Alias, column.Name);
     return column;
 }
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:5,代码来源:UnusedColumnRemover.cs


注:本文中的ColumnExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。