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)); }
private static string FindAs(Expression e) { string result = null; e.VisitAll<AsExpression>(x => result = x.Name); return result; }
public void Gather(Expression expression) { expression.Accept(this); }
public void Visit(Expression expression) { if (expression is SqlColumn) myTables.Add(((SqlColumn) expression).Table); }
public Expression Like(Expression e) { return Sql.Like(this, e); }
public static Expression In(Expression e1, Expression e2) { return Sql.In(e1, e2); }
public static Expression Or(Expression e1, Expression e2) { return Sql.Or(e1, e2); }
public static Expression And(Expression e1, Expression e2) { return Sql.And(e1, e2); }