Class AggregateColumn
Represents an aggregate column in a SQL query.
public class AggregateColumn : TrinityColumn<AggregateColumn, object>, ITrinityColumn, ITrinityComponent
- Inheritance
-
AggregateColumn
- Implements
- Inherited Members
Constructors
AggregateColumn(string, string?)
Initializes a new instance of the AggregateColumn class.
public AggregateColumn(string columnName, string? aggregateAlias = null)
Parameters
columnName
stringThe name of the column.
aggregateAlias
stringThe alias for the aggregate function.
Properties
ComponentName
The component name in the front-end side.
public override string ComponentName { get; }
Property Value
Methods
Average(string, string, string)
Defines a query that calculates the average of values in the specified column of the given table.
public AggregateColumn Average(string foreignPrimaryKeyColumn, string foreignTable, string foreignColumnToAverage)
Parameters
foreignPrimaryKeyColumn
stringThe primary key column of the foreign table to join.
foreignTable
stringThe name of the foreign table to join.
foreignColumnToAverage
stringThe name of the column to average.
Returns
- AggregateColumn
The current AggregateColumn instance.
Counts(string, string)
Defines a query that calculates the count of records in the given table.
public AggregateColumn Counts(string foreignPrimaryKeyColumn, string foreignTable)
Parameters
foreignPrimaryKeyColumn
stringThe primary key column of the foreign table to join.
foreignTable
stringThe name of the foreign table to join.
Returns
- AggregateColumn
The current AggregateColumn instance.
Max(string, string, string)
Adds a MAX aggregate function to the query for the specified foreign column.
public AggregateColumn Max(string foreignPrimaryKeyColumn, string foreignTable, string foreignColumnToMax)
Parameters
foreignPrimaryKeyColumn
stringThe name of the primary key column of the foreign table.
foreignTable
stringThe name of the foreign table.
foreignColumnToMax
stringThe name of the column in the foreign table to calculate the MAX aggregate function on.
Returns
- AggregateColumn
The current AggregateColumn instance.
Exceptions
- ArgumentNullException
Thrown when
foreignPrimaryKeyColumn
,foreignTable
, orforeignColumnToMax
is null.
Min(string, string, string)
Adds a MIN aggregate function to the query for the specified foreign column.
public AggregateColumn Min(string foreignPrimaryKeyColumn, string foreignTable, string foreignColumnToMin)
Parameters
foreignPrimaryKeyColumn
stringThe name of the primary key column of the foreign table.
foreignTable
stringThe name of the foreign table.
foreignColumnToMin
stringThe name of the column in the foreign table to calculate the MIN aggregate function on.
Returns
- AggregateColumn
The current AggregateColumn instance.
Exceptions
- ArgumentNullException
Thrown when
foreignPrimaryKeyColumn
,foreignTable
, orforeignColumnToMin
is null.
SelectQuery(Query)
Modifies the given query to include this aggregate column.
public override void SelectQuery(Query query)
Parameters
query
QueryThe query to modify.
Sum(string, string, string)
Defines a query that calculates the sum of values in the specified column of the given table.
public AggregateColumn Sum(string foreignPrimaryKeyColumn, string foreignTable, string foreignColumnToSum)
Parameters
foreignPrimaryKeyColumn
stringThe primary key column of the foreign table to join.
foreignTable
stringThe name of the foreign table to join.
foreignColumnToSum
stringThe name of the column to sum.
Returns
- AggregateColumn
The current AggregateColumn instance.