Find and case insentive


How can I assure that my where clause is always case insensitive?

like this: 

      result := OManager.Find<TEntityUnidade>.Where(TLinq.Eq('sigla', AParam)).UniqueResult;

I need that this Find to be case insensitive always. Actually all my finds and search in the database needs to be case insensitive.

thanks 

Eduardo

Currently the only way to do that is with Sql condition:


Where(TLinq.Sql<string>('Upper({sigla}) = Upper(?)', AParam))

Thanks that works very well!


However is this generic? Can I use in all supported Aurelius databases?

Thank  you

Just a general quick question regarding search expressions:


I am creating some helper functions to make the expression clearer, since seems it works for TLinq:

      result := OManager.Find<TEntityPais>.Where(EqNoCase('nome', AParam) and EqDominio).Take(1).UniqueResult;

that EqNoCase is based on what you said about the nocase:

function TNaharModel.EqNoCase(AField: string; AValue: Variant): TLinqExpression;
begin
  result := TLinq.Sql<string>('Upper({'+AField+'}) = Upper(?)', AValue);
end;

I tested and worked, however I don't know if that is ok for Aurelius. For what I saw in the source code seems good, however I have no conditions to good deep.

Can I create TLiq helper functions like that and use when construction my where clause?

Thanks again

Yes, I don't see any reason why this wouldn't work.

It's not, it will only work on databases which provide the "Upper" function. But I believe most (if not all) of them do. And you can always use some conditions and use the function specific to a database. 

We have in our todo list to add some generic functions in the TLinq criteria, but since users can use the Sql condition, it's not on a high priority.