Exemple #1
0
        public virtual IQueryState Accept(AggregateQueryExpression exp)
        {
            List <DbExpression> dbArguments = new List <DbExpression>(exp.Arguments.Count);

            foreach (Expression argument in exp.Arguments)
            {
                var arg = (LambdaExpression)argument;
                ScopeParameterDictionary scopeParameters = this._resultElement.ScopeParameters.Clone(arg.Parameters[0], this._resultElement.MappingObjectExpression);

                var dbArgument = GeneralExpressionVisitor.ParseLambda(arg, scopeParameters, this._resultElement.ScopeTables);
                dbArguments.Add(dbArgument);
            }

            DbAggregateExpression  dbAggregateExp = new DbAggregateExpression(exp.ElementType, exp.Method, dbArguments);
            MappingFieldExpression mfe            = new MappingFieldExpression(exp.ElementType, dbAggregateExp);

            ResultElement result = new ResultElement(this._resultElement.ScopeParameters, this._resultElement.ScopeTables);

            result.MappingObjectExpression = mfe;
            result.FromTable = this._resultElement.FromTable;
            result.AppendCondition(this._resultElement.Condition);

            AggregateQueryState state = new AggregateQueryState(result);

            return(state);
        }
Exemple #2
0
        public virtual IQueryState Accept(AggregateQueryExpression exp)
        {
            List <DbExpression> dbArguments = new List <DbExpression>(exp.Arguments.Count);

            foreach (Expression argument in exp.Arguments)
            {
                var arg = (LambdaExpression)argument;
                ScopeParameterDictionary scopeParameters = this._queryModel.ScopeParameters.Clone(arg.Parameters[0], this._queryModel.ResultModel);

                var dbArgument = GeneralExpressionParser.Parse(arg, scopeParameters, this._queryModel.ScopeTables);
                dbArguments.Add(dbArgument);
            }

            DbAggregateExpression dbAggregateExp = new DbAggregateExpression(exp.ElementType, exp.Method, dbArguments);
            PrimitiveObjectModel  resultModel    = new PrimitiveObjectModel(exp.ElementType, dbAggregateExp);

            QueryModel queryModel = new QueryModel(this._queryModel.ScopeParameters, this._queryModel.ScopeTables, this._queryModel.IgnoreFilters);

            queryModel.ResultModel = resultModel;
            queryModel.FromTable   = this._queryModel.FromTable;
            queryModel.AppendCondition(this._queryModel.Condition);

            AggregateQueryState state = new AggregateQueryState(queryModel);

            return(state);
        }
Exemple #3
0
        public virtual IQueryState Accept(AggregateQueryExpression exp)
        {
            List <DbExpression> dbParameters = new List <DbExpression>(exp.Parameters.Count);

            foreach (Expression pExp in exp.Parameters)
            {
                var dbExp = GeneralExpressionVisitor.VisitPredicate((LambdaExpression)pExp, this.MoeList);
                dbParameters.Add(dbExp);
            }

            DbAggregateExpression  dbAggregateExp = new DbAggregateExpression(exp.ElementType, exp.Method, dbParameters);
            MappingFieldExpression mfe            = new MappingFieldExpression(exp.ElementType, dbAggregateExp);

            ResultElement result = new ResultElement();

            result.MappingObjectExpression = mfe;
            result.FromTable = this._resultElement.FromTable;
            result.AppendCondition(this._resultElement.Condition);

            AggregateQueryState state = new AggregateQueryState(result);

            return(state);
        }