Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="select"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        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
        /// <summary>
        ///
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        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);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 protected virtual bool CompareColumnDeclaration(ColumnDeclaration a, ColumnDeclaration b)
 {
     return(a.Name == b.Name && this.Compare(a.Expression, b.Expression));
 }