-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complex value comparer expressions can not be translated by the in-memory query pipeline #27495
Comments
Note for triage: query translation only fails on in-memory database, which is interesting since the in-memory database has case-sensitive keys anyway. So it's not clear how using case-insensitive key comparison for the state manager would work for the in-memory database which is case-sensitive. |
See also #27526 |
|
@Hylaean I changed the code to use SQL Server and saw no exceptions. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing with the SQL Server or SQLite provider so that we can investigate. |
@ajcvickers: you're right, there was a bug in our test suite that lead to this misconception. thanks. |
Note from triage: closing since this is the in-memory database. |
Part of #11597 This change takes the ValueComparer defined for the principal key and uses it for the foreign key, but also accommodating for nulls appropriately. As part of this, we started getting some more complex expressions in value comparers used in the in-memory database. These expressions became part of the query, which then meant they needed to be translated. Therefore, this logic has been changed to call the value comparer as a method when using the in-memory database, and this method is then detected. This incidentally fixes #27495, which was also a case of a value comparer expression that could not be translated, and any other case where a value comparer could not be translated in in-memory queries.
Exception when querying entities linked by case insensitive string comparison in composite foreign keys
When using custom comparers on fields used in a composite foreign key, some queries can't be generated and result in an InvalidOperationException.
The tests below describe both the bug and its limits.
Exception
Provider and version information
EF Core version: 6.0.2
Database provider: SqlServer / InMemory / more?
Target framework: .net 6.0.2
Operating system: W11
The text was updated successfully, but these errors were encountered: