Dapper.Contrib icon indicating copy to clipboard operation
Dapper.Contrib copied to clipboard

String Comparison with OrdinalIgnoreCase

Open AdemCatamak opened this issue 4 years ago • 2 comments

#73

During the string comparison instead of 'CurrentCultureIgnoreCase', 'OrdinalIgnoreCase' is used. As a result, the case of unit tests in Turkish systems resulting with a failure is resolved.

Old PR : https://github.com/DapperLib/Dapper/pull/1023

AdemCatamak avatar May 12 '21 19:05 AdemCatamak

Have you tried InvariantCultureIgnoreCase ? I can't test things now, but it may be the best case? This is usually good for a neutral comparison that still takes into account some linguistic aspects.

var idProp = allProperties.Find(p => string.Equals(p.Name, "id", StringComparison.InvariantCultureIgnoreCase));

johandanforth avatar Jan 22 '22 08:01 johandanforth

I have tried InvariantCultureIgnoreCase. In my pr which is for the previous repository of the project, I linked the test-cases. It works as expected. I agree with you, InvariantCultureIgnoreCase is the best approach in cases like this.

AdemCatamak avatar Apr 15 '22 07:04 AdemCatamak