コード例 #1
0
        protected virtual DbFunctionAggregate VisitFunctionAggregate(DbFunctionAggregate aggregate)
        {
            DbFunctionAggregate result = aggregate;

            if (aggregate != null)
            {
                EdmFunction          newFunction  = this.VisitFunction(aggregate.Function);
                IList <DbExpression> newArguments = this.VisitExpressionList(aggregate.Arguments);

                Debug.Assert(newArguments.Count == 1, "Function aggregate had more than one argument?");

                if (!object.ReferenceEquals(aggregate.Function, newFunction) ||
                    !object.ReferenceEquals(aggregate.Arguments, newArguments))
                {
                    if (aggregate.Distinct)
                    {
                        result = CqtBuilder.AggregateDistinct(newFunction, newArguments[0]);
                    }
                    else
                    {
                        result = CqtBuilder.Aggregate(newFunction, newArguments[0]);
                    }
                }
            }
            return(result);
        }