Пример #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);
        }
Пример #2
0
        public virtual ResultElement CreateNewResult(LambdaExpression selector)
        {
            ResultElement result = new ResultElement();

            result.FromTable = this._resultElement.FromTable;

            IMappingObjectExpression r = SelectorExpressionVisitor.VisitSelectExpression(selector, this.MoeList);

            result.MappingObjectExpression = r;
            result.Orderings.AddRange(this._resultElement.Orderings);
            result.AppendCondition(this._resultElement.Condition);

            result.GroupSegments.AddRange(this._resultElement.GroupSegments);
            result.AppendHavingCondition(this._resultElement.HavingCondition);

            return(result);
        }
Пример #3
0
        public virtual ResultElement CreateNewResult(LambdaExpression selector)
        {
            ResultElement result = new ResultElement(this._resultElement.ScopeParameters, this._resultElement.ScopeTables);
            result.FromTable = this._resultElement.FromTable;

            ScopeParameterDictionary scopeParameters = this._resultElement.ScopeParameters.Clone(selector.Parameters[0], this._resultElement.MappingObjectExpression);

            IMappingObjectExpression r = SelectorExpressionVisitor.ResolveSelectorExpression(selector, scopeParameters, this._resultElement.ScopeTables);
            result.MappingObjectExpression = r;
            result.Orderings.AddRange(this._resultElement.Orderings);
            result.AppendCondition(this._resultElement.Condition);

            result.GroupSegments.AddRange(this._resultElement.GroupSegments);
            result.AppendHavingCondition(this._resultElement.HavingCondition);

            return result;
        }
Пример #4
0
        public virtual IQueryState Accept(FunctionExpression 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);
            }

            DbFunctionExpression   dbFuncExp = new DbFunctionExpression(exp.ElementType, exp.Method, dbParameters);
            MappingFieldExpression mfe       = new MappingFieldExpression(exp.ElementType, dbFuncExp);

            ResultElement result = new ResultElement();

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

            FunctionQueryState state = new FunctionQueryState(result);

            return(state);
        }
Пример #5
0
        public virtual ResultElement CreateNewResult(LambdaExpression selector)
        {
            ResultElement result = new ResultElement();
            result.FromTable = this._resultElement.FromTable;

            IMappingObjectExpression r = SelectorExpressionVisitor.VisitSelectExpression(selector, this.MoeList);
            result.MappingObjectExpression = r;
            result.OrderSegments.AddRange(this._resultElement.OrderSegments);
            result.AppendCondition(this._resultElement.Condition);

            result.GroupSegments.AddRange(this._resultElement.GroupSegments);
            result.AppendHavingCondition(this._resultElement.HavingCondition);

            return result;
        }
Пример #6
0
        public virtual IQueryState Accept(FunctionExpression 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);
            }

            DbFunctionExpression dbFuncExp = new DbFunctionExpression(exp.ElementType, exp.Method, dbParameters);
            MappingFieldExpression mfe = new MappingFieldExpression(exp.ElementType, dbFuncExp);

            ResultElement result = new ResultElement();

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

            FunctionQueryState state = new FunctionQueryState(result);
            return state;
        }