public virtual IQueryState Accept(GroupingQueryExpression exp) { List <IMappingObjectExpression> moeList = this.MoeList; foreach (LambdaExpression item in exp.GroupKeySelectors) { var dbExp = GeneralExpressionVisitor.ParseLambda(item, moeList); this._resultElement.GroupSegments.Add(dbExp); } foreach (LambdaExpression havingPredicate in exp.HavingPredicates) { var havingCondition = FilterPredicateExpressionVisitor.ParseFilterPredicate(havingPredicate, moeList); this._resultElement.AppendHavingCondition(havingCondition); } if (exp.Orderings.Count > 0) { this._resultElement.Orderings.Clear(); this._resultElement.InheritOrderings = false; for (int i = 0; i < exp.Orderings.Count; i++) { GroupingQueryOrdering groupOrdering = exp.Orderings[i]; DbExpression orderingDbExp = GeneralExpressionVisitor.ParseLambda(groupOrdering.KeySelector, moeList); DbOrdering ordering = new DbOrdering(orderingDbExp, groupOrdering.OrderType); this._resultElement.Orderings.Add(ordering); } } var newResult = this.CreateNewResult(exp.Selector); return(new GroupingQueryState(newResult)); }
public override IQueryState Visit(GroupingQueryExpression exp) { IQueryState prevState = exp.PrevExpression.Accept(this); IQueryState state = prevState.Accept(exp); return(state); }
public IQuery <TResult> Select <TResult>(Expression <Func <T, TResult> > selector) { var e = new GroupingQueryExpression(typeof(TResult), this._fromQuery.QueryExpression, selector); e.GroupKeySelectors.AddRange(this._groupKeySelectors); e.HavingPredicates.AddRange(this._havingPredicates); return(new Query <TResult>(this._fromQuery.DbContext, e, this._fromQuery._trackEntity)); }
public virtual IQueryState Accept(GroupingQueryExpression exp) { List <IMappingObjectExpression> moeList = this.MoeList; foreach (LambdaExpression item in exp.GroupKeySelectors) { var dbExp = GeneralExpressionVisitor.ParseLambda(item, moeList); this._resultElement.GroupSegments.Add(dbExp); } foreach (LambdaExpression havingPredicate in exp.HavingPredicates) { var havingCondition = FilterPredicateExpressionVisitor.ParseFilterPredicate(havingPredicate, moeList); this._resultElement.AppendHavingCondition(havingCondition); } var newResult = this.CreateNewResult(exp.Selector); return(new GroupingQueryState(newResult)); }
public virtual IQueryState Accept(GroupingQueryExpression exp) { List <IMappingObjectExpression> moeList = this.MoeList; foreach (var item in exp.GroupPredicates) { var dbExp = GeneralExpressionVisitor.VisitPredicate(item, moeList); this._resultElement.GroupSegments.Add(dbExp); } foreach (var item in exp.HavingPredicates) { var dbExp = GeneralExpressionVisitor.VisitPredicate(item, moeList); this._resultElement.AppendHavingCondition(dbExp); } var newResult = this.CreateNewResult(exp.Selector); return(new GroupingQueryState(newResult)); }
public virtual IQueryState Accept(GroupingQueryExpression exp) { foreach (LambdaExpression item in exp.GroupKeySelectors) { var keySelector = (LambdaExpression)item; ScopeParameterDictionary scopeParameters = this._resultElement.ScopeParameters.Clone(keySelector.Parameters[0], this._resultElement.MappingObjectExpression); var dbExp = GeneralExpressionVisitor.ParseLambda(keySelector, scopeParameters, this._resultElement.ScopeTables); this._resultElement.GroupSegments.Add(dbExp); } foreach (LambdaExpression havingPredicate in exp.HavingPredicates) { ScopeParameterDictionary scopeParameters = this._resultElement.ScopeParameters.Clone(havingPredicate.Parameters[0], this._resultElement.MappingObjectExpression); var havingCondition = FilterPredicateExpressionVisitor.ParseFilterPredicate(havingPredicate, scopeParameters, this._resultElement.ScopeTables); this._resultElement.AppendHavingCondition(havingCondition); } if (exp.Orderings.Count > 0) { this._resultElement.Orderings.Clear(); this._resultElement.InheritOrderings = false; for (int i = 0; i < exp.Orderings.Count; i++) { GroupingQueryOrdering groupOrdering = exp.Orderings[i]; ScopeParameterDictionary scopeParameters = this._resultElement.ScopeParameters.Clone(groupOrdering.KeySelector.Parameters[0], this._resultElement.MappingObjectExpression); DbExpression orderingDbExp = GeneralExpressionVisitor.ParseLambda(groupOrdering.KeySelector, scopeParameters, this._resultElement.ScopeTables); DbOrdering ordering = new DbOrdering(orderingDbExp, groupOrdering.OrderType); this._resultElement.Orderings.Add(ordering); } } var newResult = this.CreateNewResult(exp.Selector); return(new GroupingQueryState(newResult)); }
public virtual IQueryState Accept(GroupingQueryExpression exp) { foreach (LambdaExpression item in exp.GroupKeySelectors) { var keySelector = (LambdaExpression)item; ScopeParameterDictionary scopeParameters = this._queryModel.ScopeParameters.Clone(keySelector.Parameters[0], this._queryModel.ResultModel); this._queryModel.GroupSegments.AddRange(GroupKeySelectorParser.Parse(keySelector, scopeParameters, this._queryModel.ScopeTables)); } foreach (LambdaExpression havingPredicate in exp.HavingPredicates) { ScopeParameterDictionary scopeParameters = this._queryModel.ScopeParameters.Clone(havingPredicate.Parameters[0], this._queryModel.ResultModel); var havingCondition = FilterPredicateParser.Parse(havingPredicate, scopeParameters, this._queryModel.ScopeTables); this._queryModel.AppendHavingCondition(havingCondition); } if (exp.Orderings.Count > 0) { this._queryModel.Orderings.Clear(); this._queryModel.InheritOrderings = false; for (int i = 0; i < exp.Orderings.Count; i++) { GroupingQueryOrdering groupOrdering = exp.Orderings[i]; ScopeParameterDictionary scopeParameters = this._queryModel.ScopeParameters.Clone(groupOrdering.KeySelector.Parameters[0], this._queryModel.ResultModel); DbExpression orderingDbExp = GeneralExpressionParser.Parse(groupOrdering.KeySelector, scopeParameters, this._queryModel.ScopeTables); DbOrdering ordering = new DbOrdering(orderingDbExp, groupOrdering.OrderType); this._queryModel.Orderings.Add(ordering); } } QueryModel newQueryModel = this.CreateNewQueryModel(exp.Selector); return(new GroupingQueryState(newQueryModel)); }
public override JoinQueryResult Visit(GroupingQueryExpression exp) { JoinQueryResult ret = this.Visit(exp); return(ret); }
public override IQueryState Accept(GroupingQueryExpression exp) { IQueryState state = this.AsSubQueryState(); return(state.Accept(exp)); }
public virtual IQueryState Accept(GroupingQueryExpression exp) { List<IMappingObjectExpression> moeList = this.MoeList; foreach (var item in exp.GroupPredicates) { var dbExp = GeneralExpressionVisitor.VisitPredicate(item, moeList); this._resultElement.GroupSegments.Add(dbExp); } foreach (var item in exp.HavingPredicates) { var dbExp = GeneralExpressionVisitor.VisitPredicate(item, moeList); this._resultElement.AppendHavingCondition(dbExp); } var newResult = this.CreateNewResult(exp.Selector); return new GroupingQueryState(newResult); }
public override IQueryState Accept(GroupingQueryExpression exp) { IQueryState state = this.AsSubQueryState(); return state.Accept(exp); }