[CSHARP-4100] Review uses of StringComparison in StartsWith, Contains and EndsWith Created: 14/Mar/22 Updated: 28/Oct/23 Resolved: 15/Apr/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | None |
| Fix Version/s: | 2.15.1 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | James Kovacs | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
EqualsMethodToAggregationExpressionTranslator considers StringComparison.CurrentCulture and StringComparison.Ordinal to be equivalent. StartsWithContainsOrEndsWithMethodToAggregationExpressionTranslator considers StringComparison.CurrentCulture to be supported and all other StringComparison values throw ExpressionNotSupportedException. We should review our uses of StringComparison to ensure that they are consistent across the driver. Note that neither CurrentCulture nor Ordinal truly captures the server semantics. The server does not have an equivalent to Ordinal. Even CurrentCulture isn't quite right as many server functions such as $toLower only have well-defined behaviours for strings of ASCII characters. So we will have to make a design decision regarding how best to represent StringComparison values when translating to MQL or whether we should throw ExpressionNotSupportedExceptions. |
| Comments |
| Comment by Githook User [ 04/May/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 04/May/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 04/May/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 15/Apr/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 15/Apr/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 15/Apr/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Robert Stam [ 31/Mar/22 ] |
|
Other methods that have overloads with a `StringComparison` parameter will be reviewed separately. |