Example #1
0
        public Expression Build(Expression source, ApplyClause applyClause, out OeEntryFactoryFactory entryFactoryFactory)
        {
            entryFactoryFactory = new OeAggregationEntryFactoryFactory(_aggProperties);

            _aggProperties.Clear();
            if (applyClause == null)
            {
                return(source);
            }

            foreach (TransformationNode transformation in applyClause.Transformations)
            {
                if (transformation is GroupByTransformationNode groupTransformation)
                {
                    source = ApplyGroupBy(source, groupTransformation);
                }
                else if (transformation is FilterTransformationNode filterTransformation)
                {
                    source = ApplyFilter(source, filterTransformation);
                }
                else if (transformation is ComputeTransformationNode computeTransformation)
                {
                    source = ApplyCompute(source, computeTransformation);
                }
                else if (transformation is AggregateTransformationNode)
                {
                    throw new NotSupportedException();
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            return(source);
        }
Example #2
0
        public Expression Build(Expression source, ref OeSelectTranslatorParameters parameters, out OeEntryFactoryFactory entryFactoryFactory)
        {
            entryFactoryFactory = new OeSelectEntryFactoryFactory(_rootNavigationItem);

            BuildSelect(_odataUri.SelectAndExpand, parameters.MetadataLevel);
            BuildCompute(_odataUri.Compute);

            source = BuildSkipTakeSource(source, parameters.SkipTokenNameValues, parameters.IsDatabaseNullHighestValue);
            source = BuildJoin(source, FlattenNavigationItems(_rootNavigationItem, false));
            source = BuildOrderBy(source, _odataUri.OrderBy);
            source = SelectStructuralProperties(source, _rootNavigationItem);
            return(CreateSelectExpression(source));
        }