-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Labels
Milestone
Description
example scenario: Json_predicate_on_nullableenumwithconverterthathandlesnulls2
property has the following converter:
b.Property(x => x.TestNullableEnumWithConverterThatHandlesNulls).HasConversion(
new ValueConverter<JsonEnum?, string>(
x => x == null
? "Null"
: x == JsonEnum.One
? "One"
: x == JsonEnum.Two
? "Two"
: x == JsonEnum.Three
? "Three"
: "INVALID",
x => x == "One"
? JsonEnum.One
: x == "Two"
? JsonEnum.Two
: x == "Three"
? JsonEnum.Three
: null,
convertsNulls: true));
});when the clr value is null, the column stores it as "Null" string. However, when we compare the property to null, we generate the following sql:
SELECT (...)
FROM [JsonEntitiesAllTypes] AS [j]
WHERE JSON_VALUE([j].[Reference],'$.TestNullableEnumWithConverterThatHandlesNulls') IS NOT NULLwe should instead pass the null value thru the converter also so instead we should generate something like this:
SELECT (...)
FROM [JsonEntitiesAllTypes] AS [j]
WHERE JSON_VALUE([j].[Reference],'$.TestNullableEnumWithConverterThatHandlesNulls') <> 'Null'Reactions are currently unavailable