Exemplo n.º 1
0
        protected virtual JoinQuery CreateJoinQuery(IExecutionContext context, [NotNull] IMultiPartQuery query)
        {
            var filter       = query.GetFilter(context);
            var leftFilter   = filter.RemoveAllPartsThatAreNotInSource(this.Left);
            var rightFilter  = filter.RemoveAllPartsThatAreNotInSource(this.Right);
            var resultFilter = filter.SplitByAndExpressions()
                               .Except(leftFilter.SplitByAndExpressions(), JoinSourceBase.ExpressionComparer)
                               .Except(rightFilter.SplitByAndExpressions(), JoinSourceBase.ExpressionComparer)
                               .DefaultIfEmpty()
                               .Aggregate(Expression.AndAlso);

            var leftQuery = new MultiPartQuery
            {
                Fields           = query.GetUsedFields(this.Left, resultFilter),
                FilterExpression = leftFilter,
            };

            var rightQuery = new MultiPartQuery
            {
                Fields           = query.GetUsedFields(this.Right, resultFilter),
                FilterExpression = leftFilter,
            };

            return(new JoinQuery(leftQuery, rightQuery, resultFilter, query.OrderByExpressions));
        }
Exemplo n.º 2
0
        protected override JoinQuery CreateJoinQuery(IExecutionContext context, [NotNull] IMultiPartQuery query)
        {
            var resultFilter = query.GetFilter(context);

            var leftQuery = new MultiPartQuery
            {
                Fields = query.GetUsedFields(this.Left, resultFilter),
            };
            var rightQuery = new MultiPartQuery
            {
                Fields = query.GetUsedFields(this.Right, resultFilter),
            };

            return(new JoinQuery(leftQuery, rightQuery, resultFilter, query.OrderByExpressions));
        }