-
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
Make collation part of type mapping #29620
Comments
Not necessarily pushing back, but some thoughts:
We should also figure out if doing this would solve any concrete bugs (or enable features), or whether it's a pure cleanup/refactor. |
We now have a real use-case for tracking/bubbling up collations in the query tree. With the new primitive collection support in 8.0, we do much wider type mapping inference as before. For example: var query = db.Blogs
.Where(b => ids.Contains(b.Id))
.ToList(); ... now generates: SELECT [b].[Id]
FROM [Blogs] AS [b]
WHERE [b].[Id] IN (
SELECT [i].[value]
FROM OPENJSON(@__ids_0) WITH ([value] nvarchar(450) '$') AS [i]
) Note that in this query, the collation of The same thing needs to happen with the collation of the To properly fix this, we should make the collation part of the type mapping, so that it can bubble up (in case there's a complex expression tree instead of just a single column), and then have it inferred and applied to the OPENJSON parameter. |
There's another alternative to integrating the collation within the type mapping - we can also add it to SqlExpression instead (so alongside the type mapping). That would allow it to be bubbled up by inference code, without forcing it through our type mapping system, where I'm still not sure whether it belongs. Just a thought for when we get around to doing this. |
See #27624, #29518, and https://github.com/dotnet/efcore/issues?q=is%3Aissue+is%3Aopen+collation
The text was updated successfully, but these errors were encountered: