예제 #1
0
        public override DbExpression Visit(DbGroupByExpression expression)
        {
            Check.NotNull(expression, "expression");

            DbExpression result = expression;

            var newInput = VisitGroupExpressionBinding(expression.Input);

            EnterScope(newInput.Variable);
            var newKeys = VisitExpressionList(expression.Keys);

            ExitScope();
            EnterScope(newInput.GroupVariable);
            var newAggs = VisitList(expression.Aggregates, VisitAggregate);

            ExitScope();

            if (!ReferenceEquals(expression.Input, newInput)
                ||
                !ReferenceEquals(expression.Keys, newKeys)
                ||
                !ReferenceEquals(expression.Aggregates, newAggs))
            {
                var groupOutput =
                    TypeHelpers.GetEdmType <RowType>(TypeHelpers.GetEdmType <CollectionType>(expression.ResultType).TypeUsage);

                var boundKeys = groupOutput.Properties.Take(newKeys.Count).Select(p => p.Name).Zip(newKeys).ToList();
                var boundAggs = groupOutput.Properties.Skip(newKeys.Count).Select(p => p.Name).Zip(newAggs).ToList();

                result = CqtBuilder.GroupBy(newInput, boundKeys, boundAggs);
            }
            NotifyIfChanged(expression, result);
            return(result);
        }
예제 #2
0
 /// <summary>
 /// Visitor pattern method for <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression" />.
 /// </summary>
 /// <param name="expression"> The DbExpression that is being visited. </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="expression" />
 /// is null
 /// </exception>
 public override void Visit(DbGroupByExpression expression)
 {
     Check.NotNull <DbGroupByExpression>(expression, nameof(expression));
     this.VisitGroupExpressionBindingPre(expression.Input);
     this.VisitExpressionList(expression.Keys);
     this.VisitGroupExpressionBindingMid(expression.Input);
     this.VisitAggregateList(expression.Aggregates);
     this.VisitGroupExpressionBindingPost(expression.Input);
 }
예제 #3
0
        /// <summary>
        ///     Visitor pattern method for <see cref="DbGroupByExpression" />.
        /// </summary>
        /// <param name="expression"> The DbExpression that is being visited. </param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="expression" />
        ///     is null
        /// </exception>
        public override void Visit(DbGroupByExpression expression)
        {
            Check.NotNull(expression, "expression");

            VisitGroupExpressionBindingPre(expression.Input);
            VisitExpressionList(expression.Keys);
            VisitGroupExpressionBindingMid(expression.Input);
            VisitAggregateList(expression.Aggregates);
            VisitGroupExpressionBindingPost(expression.Input);
        }
 /// <summary>
 /// When overridden in a derived class, implements the visitor pattern for
 /// <see
 ///     cref="T:System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression" />
 /// .
 /// </summary>
 /// <returns>A result value of a specific type.</returns>
 /// <param name="expression">
 /// The <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression" /> that is being visited.
 /// </param>
 public abstract TResultType Visit(DbGroupByExpression expression);
 /// <summary>
 /// When overridden in a derived class, implements the visitor pattern for
 /// <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression" />
 /// .
 /// </summary>
 /// <param name="expression">
 /// The <see cref="T:System.Data.Entity.Core.Common.CommandTrees.DbGroupByExpression" /> that is visited.
 /// </param>
 public abstract void Visit(DbGroupByExpression expression);
 public override void Visit(DbGroupByExpression expression)
 {
 }