protected override SqlBuilder In(ConstantExpression expression, SqlBuilder sqlBuilder) { if (expression.Type.Name == "String") { sqlBuilder.AppendFormat("'{0}',", expression.Value); } else { sqlBuilder.AppendFormat("{0},", expression.Value); } return(sqlBuilder); }
private SqlBuilder AggregateFunctionParser(MemberExpression expression, SqlBuilder sqlBuilder) { string aggregateFunctionName = new StackTrace(true).GetFrame(1).GetMethod().Name.ToLower(); string tableName = expression.Member.DeclaringType.Name; string columnName = expression.Member.Name; sqlBuilder.SetTableAlias(tableName); string tableAlias = sqlBuilder.GetTableAlias(tableName); if (!string.IsNullOrWhiteSpace(tableAlias)) { tableName += " " + tableAlias; columnName = tableAlias + "." + columnName; } sqlBuilder.AppendFormat("select {0}({1}) from {2}", aggregateFunctionName, columnName, tableName); return(sqlBuilder); }