efcore
efcore copied to clipboard
Use the JSON `id` property directly if the mapped property is already converted to a string
If the EF primary key property is a string, then we map it directly to the JSON id property. If it is numeric (or bool), then we map a string of the number to id but keep the numeric key property in the JSON as well, so that queries can use the numeric value rather than needing to use the string. Currently, when the key property is not a string, but is converted to a string--e.g. a GUID--then we map to both the JSON id and the original property, like for numerics. But there is no need to do this, since the id is already a string.
Note for team: we should do this for 9 to avoid a break afterwards.