public void TestExpression() { using (var con = new NpgsqlConnection(Infrastructure.PgSql.PgConfig.ConnectionStr)) { var a = new DapperExtension <TUser>(); var list = a.Select("max(id),name") .Where(p => (p.Id >= 0 || p.Name == "name") && p.Name != null) .GroupBy(p => new { p.Name }) .Having("having count(1)>0") .ToList(con); } }