示例#1
0
        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);
        }
示例#2
0
 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);
 }
示例#3
0
        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));
        }
示例#4
0
        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);
        }