public static HashSet <DbColumnExpression> Gather(Expression expression) { var visitor = new DbReferencedColumnGatherer(); if (visitor != null) { visitor.Visit(expression); } return(visitor.columns); }
protected override Expression VisitSelect(DbSelectExpression select) { var saveColumns = this.columns; this.columns = DbReferencedColumnGatherer.Gather(select).ToLookup(c => c.Alias); var saveLastJoin = this.lastJoin; this.lastJoin = null; var result = base.VisitSelect(select); this.columns = saveColumns; this.lastJoin = saveLastJoin; return(result); }