Nhibernate中Orderby的字段为空值时
程序员文章站
2024-03-16 09:18:58
...
// sql function definition
var sqlFunction = new SQLFunctionTemplate(NHibernateUtil.String
, "COALESCE(this_.AAA104, 0)");
// create projection
var projection = Projections.SqlFunction(sqlFunction,
NHibernateUtil.Int32);
// order by projection
cr.AddOrder(new Order(projection, false));
参考链接:
https://*.com/questions/13394712/keep-null-values-last-in-nhibernate-sorting
上一篇: fastJson转换json字符串时不输出空值的解决办法
下一篇: 简单算法之折半查找