c# - Like doesn't escape special characters NHibernate -


i have problem nhibernate linq contains method, because want escape special characters in string example if type:

lel%lel 

i want find

lel%lel not lel4325234534lel 

to find values use following methods:

tabarray = _session.query<tab>()                     .where(x => x.attr.contains(query))                     .toarray(); 

i try using likeexpression didn't help.

i say, should (our code) not nhibernate. can use this:

how escape percentage sign in t-sql?

i.e. replace % in c# [%]

lel[%]lel  

and return expected

.where(x => x.attr.contains(query)) // query == "lel[%]lel" 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -