0
我想这样的查询:使用nhibernate调用sql函数?
select * from table where concat(',', ServiceCodes, ',') like '%,33,%';
select * from table where (','||ServiceCodes||',') like '%,33,%';
所以,我写了这个代码:
ICriteria cri = NHibernateSessionReader.CreateCriteria(typeof(ConfigTemplateList));
cri.Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("ServiceCodes")), "%,33,%"));
我得到的SQL类似:
select * from table where (ServiceCodes) like '%,33,%';
但它不是我想要的,怎么做??? 谢谢!