开发者

nhibernate criteria, like on words

开发者 https://www.devze.com 2023-02-20 06:23 出处:网络
I want to do this with a nhibernate criteria: SELECT Text FROM Table WHERE Text Like \'Re% Wi%\' The result should be:

I want to do this with a nhibernate criteria:

SELECT Text FROM Table WHERE Text Like 'Re% Wi%'

The result should be:

Red Wine

I have the search parameter as a string 'Re Wi' from the user interface.

What is the best approach? split the string and put % at the end, join the string array and end up with:

开发者_C百科
criteria.Add(Restrictions.Like("Text", 'Re% Wi%', MatchMode.Start))

Or can I add the individual parts (beginning of words) to some criteria expression?

0

精彩评论

暂无评论...
验证码 换一张
取 消