Skip to content

Support translating some string functions when they have a char parameters - #34999

Merged
roji merged 3 commits into
dotnet:mainfrom
ChrisJollyAU:fix32482
Mar 21, 2025
Merged

roji merged 3 commits into
dotnet:mainfrom
ChrisJollyAU:fix32482

Conversation

@ChrisJollyAU

Copy link
Copy Markdown
Contributor

Translate string functions that also take a char as a parameter.

Adds support for the following to also have a char parameter in addition to the currently supported string parameter.

  • StartsWith
  • EndsWith
  • Contains
  • Replace
  • IndexOf

Comes in handy when you are following some code suggestions, and you get this one https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1865-ca1867

Most translations are just an extension of the current string parameter version - just match the right method and handle the char version with the right type mapping.

Also Indexof_with_constant_starting_position and Indexof_with_parameter_starting_position are now successfully translated for sqlite

This fixes #32482

@ChrisJollyAU

Copy link
Copy Markdown
Contributor Author

Update to resync other changes to the structure of the base tests

@roji roji assigned roji and unassigned maumar Mar 21, 2025

@roji roji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ChrisJollyAU - great work as always, and sorry it's taking us so long to process PRs at the moment.

@changhuixu

Copy link
Copy Markdown

Which version of EF Core will have this fix?

@roji

roji commented Dec 14, 2025

Copy link
Copy Markdown
Member

@changhuixu look at the milestone of the corresponding issue (#32482) - it's 10.0.0.

@changhuixu

Copy link
Copy Markdown

Thank you @roji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StartsWith(char) can't be used with EF Core 8

6 participants