EFIngresProvider/SqlGen/SqlGenerator/SqlGeneratorCommonVisitors.cs
/// <summary>
/// Aggregates are not visited by the normal visitor walk.
/// </summary>
/// <param name="aggregate">The aggreate go be translated</param>
/// <param name="aggregateArgument">The translated aggregate argument</param>
/// <returns></returns>
Aggregates are not visited by the normal visitor walk.
Aggregates are not visited by the normal visitor walk .
private SqlBuilder VisitAggregate(DbAggregate aggregate, ISqlFragment aggregateArgument)
        {
            SqlBuilder aggregateResult = new SqlBuilder();
            DbFunctionAggregate functionAggregate = aggregate as DbFunctionAggregate;
            if (functionAggregate == null)
            {
                throw new NotSupportedException();
            }
            if (MetadataHelpers.IsCanonicalFunction(functionAggregate.Function)
                && String.Equals(functionAggregate.Function.Name, "BigCount", StringComparison.Ordinal))
            {
                aggregateResult.Append("COUNT_BIG");
            }
            else
            {
                WriteFunctionName(aggregateResult, functionAggregate.Function);
            }
            aggregateResult.Append("(");
            DbFunctionAggregate fnAggr = functionAggregate;
            if ((null != fnAggr) && (fnAggr.Distinct))
            {
                aggregateResult.Append("DISTINCT ");
            }
            aggregateResult.Append(aggregateArgument);
            aggregateResult.Append(")");
            return aggregateResult;
        }
private SqlBuilder VisitAggregate ( DbAggregate aggregate , ISqlFragment aggregateArgument ) { SqlBuilder aggregateResult = new SqlBuilder ( ) ; DbFunctionAggregate functionAggregate = aggregate as DbFunctionAggregate ; if ( functionAggregate == null ) { throw new NotSupportedException ( ) ; } if ( MetadataHelpers . IsCanonicalFunction ( functionAggregate . Function ) && String . Equals ( functionAggregate . Function . Name , " " , StringComparison . Ordinal ) ) { aggregateResult . Append ( " " ) ; } else { WriteFunctionName ( aggregateResult , functionAggregate . Function ) ; } aggregateResult . Append ( " " ) ; DbFunctionAggregate fnAggr = functionAggregate ; if ( ( null != fnAggr ) && ( fnAggr . Distinct ) ) { aggregateResult . Append ( " " ) ; } aggregateResult . Append ( aggregateArgument ) ; aggregateResult . Append ( " " ) ; return aggregateResult ; }
Aggregates are not visited by the normal visitor walk.
Aggregates are not visited by the normal visitor walk .
//The only aggregate function with different name is Big_Count //Note: If another such function is to be added, a dictionary should be created
None
aggregate
DbAggregate
The aggreate go be translated
The aggreate go be translated
aggregateArgument
ISqlFragment
The translated aggregate argument
The translated aggregate argument