Open nhibernate-bot opened 7 years ago
Depends on #944
Is it still open or the feature is done ? I would like to help
No, it is not done.
I think no completely satisfactory solution can be done. In .Net, comparisons are case sensitive by default, but NHibernate has no way to know if the database will do a case sensitive match or a case insensitive one. This depends on the database settings.
In the case of SQL-Server by example, this can be set at the column level, database level or server level (through collation of column, default collation of database, or default collation of the server). A query can supply a collation on a string comparison, but NHibernate has no way to know which one should be used, since there are more than one case sensitive collation or case insensitive collation. And specifying a collation in a query can have averse effects, such as discarding indexes for the query and causing table scans instead.
The suggestion about the ilike
in comments here only covers the case where the default comparison is case-sensitive and it is wished to do a case-insensitive one. ilike
is currently a Criteria "trick" emulating case-insensitive comparison by, in most cases, lower-casing operands first. This may have issues (Turkish i issues notably). (In some cases, say PostgreSQL, it uses a built-in feature of the database handling this.)
In most cases, it is better to adjust the database, provided it offers such a possibility.
Jose F. Romaniello created an issue — :