예제 #1
0
        private Expression JoinReplacer(QueryModel queryModel, Expression expression)
        {
            var joins = LeftJoinDetector.Detect(expression, new NameGenerator(queryModel), _sessionFactory);

            Expression result = expression;

            if (joins.Joins.Count > 0)
            {
                result = joins.Selector;

                queryModel.TransformExpressions(e => ExpressionSwapper.Swap(e, joins.ExpressionMap));

                foreach (var join in joins.Joins)
                {
                    queryModel.BodyClauses.Add(join);
                }
            }

            return(result);
        }
예제 #2
0
        public static Expression Swap(Expression expression, Dictionary <Expression, Expression> expressionMap)
        {
            var swapper = new ExpressionSwapper(expressionMap);

            return(swapper.VisitExpression(expression));
        }