Exemple #1
0
        public static SelectExpression RemoveColumn(this SelectExpression select, ColumnDeclaration column)
        {
            List <ColumnDeclaration> columns = new List <ColumnDeclaration>(select.Columns);

            columns.Remove(column);
            return(select.SetColumns(columns));
        }
Exemple #2
0
        protected virtual ReadOnlyCollection <ColumnDeclaration> VisitColumnDeclarations(ReadOnlyCollection <ColumnDeclaration> columns)
        {
            List <ColumnDeclaration> alternate = null;

            for (int i = 0, n = columns.Count; i < n; i++)
            {
                ColumnDeclaration column = columns[i];
                Expression        e      = this.Visit(column.Expression);
                if (alternate == null && e != column.Expression)
                {
                    alternate = columns.Take(i).ToList();
                }
                if (alternate != null)
                {
                    alternate.Add(new ColumnDeclaration(column.Name, e));
                }
            }
            if (alternate != null)
            {
                return(alternate.AsReadOnly());
            }
            return(columns);
        }
Exemple #3
0
 protected virtual bool CompareColumnDeclaration(ColumnDeclaration a, ColumnDeclaration b)
 {
     return(a.Name == b.Name && Compare(a.Expression, b.Expression));
 }