Ï think you'll have to create your own "ToLowerParameter" extension method
and use that instead of ToLower. Mark the method with

[LinqExtensionMethod("lower")]

"Since NHibernate v5.0, the Linq provider will no more evaluate in-memory
the method call even when it does not depend on the queried data."

In other words, it will be converted into a SQL call.

/G


Den tis 30 okt. 2018 kl 16:54 skrev Andreas Eriksson <
andreas.o.eriks...@gmail.com>:

> I have the following linq query
>
> session.Query<Car>().Where(c => c.Name.ToLower() == name.ToLower()).Select
> (c=> c.Id)
>
> which translates into the following sql query
> select car0_."Id" as col_0_0_ from "Car" car0_ where lower(car0_.
> "Identifier")=:p0;:p0 = 'volvo'
>
>
> How can I force NHibernate to use lower for the parameter as well?
> I want the sql to look like this:
> select car0_."Id" as col_0_0_ from "Car" car0_ where lower(car0_.
> "Identifier")=lower(:p0);:p0 = 'Volvo'
>
> /Andreas
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nhusers+unsubscr...@googlegroups.com.
> To post to this group, send email to nhusers@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to