-
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
Consider removing support for collections of primitives typed as object array/list used in parameters to queries #35332
Comments
I can indeed see that the list comparer type is In other words, it would be good if you could provide a bit more context on what exact trouble this is causing you?
For mixing ints/strings you're right, but there are other cases where e.g. inheritance is involved, and so a list of heterogeneous CLR types may need to be used. A case that comes to mind is the spatial types: var spatialThings = new object[] { new Point(...), new Polygon(...) }; All these are subclasses of NetTopologySuite's Geometry, so if you have a Geometry property on an entity type, it could make sense to do Contains like this. It's true that I'd use a Regardless, we generally try to translate stuff that works in regular LINQ, so if the user for some reason has a collection typed as As a side note, when pasting test snippets, it would be great if you could paste the name of the test (Where_array_of_object_contains_over_value_type), or just the whole test including the method signature - in this case it's very short. This allows jumping directly to it without having to search for the code. |
I see now, this is about #35326 (would be good to link in the issue to give the context!) |
@roji This is specifically about |
@AndriySvyryd I don't quite understand... The idea of removing |
Currently it's possible to do something like this:
This generates type mapping with a comparer being ListOfReferenceTypesComparer typed as object, but it's element comparer is
DefaultValueComparer<int>
. This makes it harder to reason about types of things involved (type argument of the element comparer is not compatible with type argument of the collection comparer), but doesn't really buy us much - if the collection contains non-int it will blow up anyway.We should consider removing this to make our code cleaner.
The text was updated successfully, but these errors were encountered: