Table of Contents

Class AggregateColumn

Namespace
AbanoubNassem.Trinity.Columns
Assembly
AbanoubNassem.Trinity.dll

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 string

The name of the column.

aggregateAlias string

The alias for the aggregate function.

Properties

ComponentName

The component name in the front-end side.

public override string ComponentName { get; }

Property Value

string

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 string

The primary key column of the foreign table to join.

foreignTable string

The name of the foreign table to join.

foreignColumnToAverage string

The 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 string

The primary key column of the foreign table to join.

foreignTable string

The 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 string

The name of the primary key column of the foreign table.

foreignTable string

The name of the foreign table.

foreignColumnToMax string

The 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, or foreignColumnToMax 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 string

The name of the primary key column of the foreign table.

foreignTable string

The name of the foreign table.

foreignColumnToMin string

The 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, or foreignColumnToMin is null.

SelectQuery(Query)

Modifies the given query to include this aggregate column.

public override void SelectQuery(Query query)

Parameters

query Query

The 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 string

The primary key column of the foreign table to join.

foreignTable string

The name of the foreign table to join.

foreignColumnToSum string

The name of the column to sum.

Returns

AggregateColumn

The current AggregateColumn instance.