我正在做一些伏都教,并且需要使用c#/linq/ bit_count -nhibernate对我的结果进行排序。
下面是我当前的订单声明:
orderby m.InitiatorInventory & wanted descending我真正想要的是这样的东西
orderby BIT_COUNT(m.InitiatorInventory & wanted descending)这是Mysql函数:
http://dev.mysql.com/doc/refman/5.0/en/bit-functions.html#function_bit-count
发布于 2011-04-15 06:46:23
您可以使用CreateSQLQuery,也可以在NHibernate中注册您自己的BIT_COUNT方言:
public class MyDialect : MySqlDialect
{
public MyDialect()
{
RegisterFunction("bit_count", new StandardSQLFunction("bit_count", null));
}
}更多信息here。
https://stackoverflow.com/questions/5668151
复制相似问题