/// <summary> /// Creates a SqlExpression with an aggergation function /// </summary> /// <param name="func">Aggregation function to be applied on the supplied expression</param> /// <param name="param">Parameter of the aggregation function</param> /// <returns></returns> public static SqlExpression Function(SqlAggregationFunction func, SqlExpression param) { SqlExpression expr = new SqlExpression(); expr.type = SqlExpressionType.Function; expr.subExpr1 = param; expr.func = func; return(expr); }
public SelectColumn(string columnName, FromTerm table, SqlAggregationFunction function) { if (function == SqlAggregationFunction.None) { expr = SqlExpression.Field(columnName, table); } else { expr = SqlExpression.Function(function, SqlExpression.Field(columnName, table)); } }
public SelectColumn(string columnName, FromTerm table, string columnAlias, SqlAggregationFunction function) { if (function == SqlAggregationFunction.None) { this.expr = SqlExpression.Field(columnName, table); } else { this.expr = SqlExpression.Function(function, SqlExpression.Field(columnName, table)); } this.alias = columnAlias; }
/// <summary> /// Creates a SelectColumn with a column name, table, column alias and optional aggregation function /// </summary> /// <param name="columnName">Name of a column</param> /// <param name="table">The table this OtherData belongs to</param> /// <param name="columnAlias">Alias of the column</param> /// <param name="function">Aggregation function to be applied to the column. Use SqlAggregationFunction.None to specify that no function should be applied.</param> public SelectColumn(string columnName, FromTerm table, string columnAlias, SqlAggregationFunction function) { _table = table; if (function == SqlAggregationFunction.None) { expr = SqlExpression.Field(columnName, table); } else { expr = SqlExpression.Function(function, SqlExpression.Field(columnName, table)); } this.alias = columnAlias; }
/// <summary> /// Renders a SqlExpression of type Function /// </summary> /// <param name="builder"></param> /// <param name="func"></param> /// <param name="param"></param> protected virtual void Function(StringBuilder builder, SqlAggregationFunction func, SqlExpression param) { builder.AppendFormat("{0}(", func.ToString()); Expression(builder, param); builder.AppendFormat(")"); }
public static SqlExpression Function(SqlAggregationFunction func, SqlExpression param) { SqlExpression expression = new SqlExpression(); expression.type = SqlExpressionType.Function; expression.subExpr1 = param; expression.func = func; return expression; }
public SelectColumn(Enum columnName, FromTerm table, SqlAggregationFunction function) : this(columnName.ToString(), table, function) {}
public SelectColumn(Enum columnName, FromTerm table, SqlAggregationFunction function) : this(columnName.ToString(), table, function) { }