Open ajcvickers opened 3 years ago
For equal/non-equal we may be able to do something to convert it to IS (NOT) NULL
but it wouldn't work in large case when comparison or other operators started to use. This is something we shouldn't support.
@dotnet/efteam I wonder if we should warn if you create a value converter like this. Or maybe even pull the feature. Let's discuss in triage tomorrow.
Backlog for now. See also https://github.com/dotnet/efcore/issues/26230.
Seems like a specific case of #10434/#15979. We should also consider what should happen when a join on the converted values is used.
Since null
often has special handling perhaps we need to expose more metadata on value converters to indicate whether null
is preserved during conversion and whether null
could be produced from a non-null
value.
Similar to #26210, but in this case conversion is from null in the database to non-null in code.
Note that this could be another reason not to convert nulls. I don't expect us to do anything about this in 6.0. Maybe ever.
Value converter replaces nulls in the database with non-value in the model:
Query:
Generates SQL:
Which generates no results because nothing is equal to null in SQL.
Full repro: