protected virtual Expression VisitOuterJoined(OuterJoinedExpression outer) { Expression test = this.Visit(outer.Test); Expression expression = this.Visit(outer.Expression); if (test != outer.Test || expression != outer.Expression) { return(new OuterJoinedExpression(test, expression)); } return(outer); }
public static ProjectionExpression AddOuterJoinTest(this ProjectionExpression proj) { string colName = proj.Source.GetAvailableColumnName("Test"); SelectExpression newSource = proj.Source.AddColumn(new ColumnDeclaration(colName, Expression.Constant(1, typeof(int?)))); Expression newProjector = new OuterJoinedExpression( new ColumnExpression(typeof(int?), newSource.Alias, colName), proj.Projector ); return(new ProjectionExpression(newSource, newProjector, proj.Aggregator)); }
protected virtual Expression VisitOuterJoined(OuterJoinedExpression outer) { this.Write("Outer("); this.WriteLine(Indentation.Inner); this.Visit(outer.Test); this.Write(", "); this.WriteLine(Indentation.Same); this.Visit(outer.Expression); this.WriteLine(Indentation.Outer); this.Write(")"); return(outer); }
protected override Expression VisitOuterJoined(OuterJoinedExpression outer) { Expression expr = Visit(outer.Expression); ColumnExpression column = (ColumnExpression)outer.Test; ParameterExpression reader; int iOrdinal; if (scope.TryGetValue(column, out reader, out iOrdinal)) { return(Expression.Condition( Expression.Call(reader, "IsDbNull", null, Expression.Constant(iOrdinal)), Expression.Constant(null, outer.Type), expr )); } return(expr); }