public Expression Build(Expression source, IReadOnlyList <OeSkipTokenNameValue> skipTokenNameValues, OrderByClause uniqueOrderBy)
        {
            OrderProperty[] orderProperties = CreateOrderProperies(source, skipTokenNameValues, uniqueOrderBy);
            Expression      filter          = CreateFilterExpression(_isDatabaseNullHighestValue, orderProperties);

            LambdaExpression lambda          = Expression.Lambda(filter, _visitor.Parameter);
            MethodInfo       whereMethodInfo = OeMethodInfoHelper.GetWhereMethodInfo(_visitor.Parameter.Type);

            return(Expression.Call(whereMethodInfo, source, lambda));
        }
Example #2
0
        private static MethodCallExpression CreateWhereExpression(ParameterExpression sourceParameter, Expression subquery, IEdmNavigationProperty edmNavigationProperty)
        {
            Type             subqueryType      = OeExpressionHelper.GetCollectionItemType(subquery.Type);
            var              subqueryParameter = Expression.Parameter(subqueryType, subqueryType.Name);
            BinaryExpression joinExpression    = GetJoinExpression(sourceParameter, subqueryParameter, edmNavigationProperty);
            LambdaExpression predicate         = Expression.Lambda(joinExpression, subqueryParameter);

            MethodInfo whereMethodInfo = OeMethodInfoHelper.GetWhereMethodInfo(subqueryType);

            return(Expression.Call(whereMethodInfo, subquery, predicate));
        }
Example #3
0
        private MethodCallExpression ApplyFilter(Expression source, FilterTransformationNode transformation)
        {
            Type sourceType = OeExpressionHelper.GetCollectionItemType(source.Type);
            ParameterExpression sourceParameter = Expression.Parameter(sourceType);

            var visitor = CreateVisitor(sourceParameter);

            if (_aggProperties.Count > 0)
            {
                visitor.TuplePropertyByAliasName = GetTuplePropertyByAliasName;
            }
            Expression e = visitor.TranslateNode(transformation.FilterClause.Expression);

            MethodInfo       whereMethodInfo = OeMethodInfoHelper.GetWhereMethodInfo(sourceParameter.Type);
            LambdaExpression lambda          = Expression.Lambda(e, sourceParameter);

            return(Expression.Call(whereMethodInfo, source, lambda));
        }