Thanks Gunnar,
that work as expected.
I was trying to implement it by overriding BaseHqlGeneratorForMethod but
your solution is much simpler.
Den tisdag 30 oktober 2018 kl. 17:02:06 UTC+1 skrev Gunnar Liljas:
>
> Ï 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 <
> [email protected] <javascript:>>:
>
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.