nhibernate quote character replacing with \"

168 Views Asked by At

Hi i making filter with linq nhibernate all working good but when i try filter text with quote select return nothing...

qr.Where(o => o.Desc.ToLower().Equals("some text")); // working
qr.Where(o => o.Desc.ToLower().Equals("some \"text\""));
// not working because nhibernate bind parameter as  'some \"text\"' but not  'some "text"'

Its some nhibernate bug? Or exist some option witch force nhibernate replace " with \" ? Thanks for all

1

There are 1 best solutions below

1
On BEST ANSWER

It works fine for me (just tried your exact code)

What version of NH are you using?

var foos = session.Query<Foo>()
                  .Where(o => o.Desc.ToLower().Equals("some \"text\""))
                  .ToList();

Output:

NHibernate:
    select
        foo0_.id as id0_,
        foo0_.[Desc] as Desc2_0_
    from
        Foo foo0_
    where
        lower(foo0_.[Desc])=@p0;
    @p0 = 'some "text"' [Type: String (4000)]