Skip to content

Conversation

@ahmetsevgili
Copy link

@ahmetsevgili ahmetsevgili commented Jan 25, 2026

This PR introduces support for string[] type mapping in the MySQL EF Core provider.
Problem
When using EF Core 10 with MySQL, queries that rely on Contains with a string[] fail with the following exception:

``InvalidOperationException: Expression '@stringarray' in the SQL tree does not have a type mapping assigned.'`

This occurs because the provider does not currently assign a relational type mapping for string collections, even though EF Core 10 expects it.

Solution

The type mapping source has been updated to handle both string and string[]:

else if (clrType == typeof(string) || clrType == typeof(string[]))
{
    // existing string mapping logic
}

This ensures that string[] is recognized and mapped correctly, allowing queries such as:

string[] stringArray = new string[] { "TEST" }; var result = context.StringCodeMatch.FirstOrDefault(q => stringArray.Contains(q.Code));

to execute without error.

@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@ahmetsevgili
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants