From: Patrick E. (JIRA) <nh...@gm...> - 2010-11-24 16:08:10
|
[ http://216.121.112.228/browse/NH-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20161#action_20161 ] Patrick Earl commented on NH-2099: ---------------------------------- I'm good with translating the StringComparison part. The tricky part is getting SQL server out of its case insensitive mode. As far as I can tell, you'd need to determine the collation setting of a column and then perform some sort of automatic mapping between the case insensitive collation and the case sensitive collation. Then you'd need to use that collation in the query. See method 2 for an example: http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm The current behavior is consistent with Linq to SQL: http://yourdotnetdesignteam.blogspot.com/2010/06/case-sensitive-linq-to-sql-queries.html Given this evidence, I would recommend the use of case sensitive collations on columns with case sensitive data. The only case where this may be a problem is in legacy databases where the collation cannot be modified. However, I believe this would be sufficiently rare that the user could write more a more customized query and skip the Linq provider. This leads me to another question that I don't have time to look up at this exact moment... does NHibernate do automatic collation mapping elsewhere? > Linq Expressions and case sensitivity > ------------------------------------- > > Key: NH-2099 > URL: http://216.121.112.228/browse/NH-2099 > Project: NHibernate > Issue Type: New Feature > Components: Linq Provider > Affects Versions: 3.0.0.Alpha1 > Reporter: Jose F. Romaniello > Priority: Minor > > The following query: > persons.Where(p => p.Nombre.StartsWith("a")) > in objects is case-sensitive. And I would like in nhibernate be case sensitive too. > otherwise: > persons.Where(p => p.Nombre.StartsWith("a", StringComparison.OrdinalIgnoreCase)) > In sql server it is possible to change the "coalesce" in the where statement. I don't know for other providers. > The same for others string operators. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |