private static string FindAs(Expression e) { string result = null; e.VisitAll<AsExpression>(x => result = x.Name); return result; }
public void AddColumn(Expression col) { string asName = FindAs(col); string colName = asName; if (asName == null) colName = "col_" + (myColumns.Count + 1); bool binded = false; col.VisitAll<BindExpression>(x => { x.BindColumn.Name = colName; binded = true; }); myColumns.Add(new KeyValuePair<string, Expression>( (binded || asName != null) ? colName : null, col)); }