我需要使用nhibernate调用mysql函数,类似的sql语句:
select * from concat(',', ServiceCodes, ',') like '%,33,%';
或select * from (','||ServiceCodes||',') like '%,33,%';
所以我就这样调用:
//.....
C# code:
or.Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("ServiceCodes")), "%," + item + ",%"));
//....
Projections.SqlFunction函数第三个参数是params IProjection[] projections,但是对于逗号(,)我不知道怎么创建IProjection类似。
请各位指教。。。
select * from concat(',', ServiceCodes, ',') like '%,33,%';
或select * from (','||ServiceCodes||',') like '%,33,%';
->
select * from table where concat(',', ServiceCodes, ',') like '%,33,%';
或select * from table where (','||ServiceCodes||',') like '%,33,%';
等待答案。
另一地址:http://stackoverflow.com/questions/2680116/invoke-sql-function-using-nhibernate
可怜,没人理.........
渺茫的顶一下...
没有结果,不满意结账