An EntityType with property char is not supported by the SQL Server provider. However SqlServerTypeMapper does have a mapping in _clrTypeMappings for char (mapping it to a SQL Server int column).
The reason for this is to support generation of single character literals in the Query Pipeline e.g. as arguments to functions, or LIKE can take an ESCAPE argument which is a single character - see this test. Query checks that it can interpret each argument (in this case a single character) - if it fails to find a type mapping for that type then it assumes it cannot generate literals for that type.
We should remove the entry in _clrTypeMappings for SqlServerTypeMapper for char so that we will generate the correct error if someone tries to create a property of that type. But we need to provide an alternate means to translate the literal above. We discussed:
- Just changing how we deal with
LIKE to enforce that the ESCAPE argument is a string, or
- Changing the way Query treats arguments in general to specifically allow it to try a
string TypeMapping if a char one does not exist.
- Updating the TypeMapper to allow a set of types which it can interpret for generation of literals even if it does not allow that type as a property type.
An EntityType with property
charis not supported by the SQL Server provider. HoweverSqlServerTypeMapperdoes have a mapping in_clrTypeMappingsforchar(mapping it to a SQL Serverintcolumn).The reason for this is to support generation of single character literals in the Query Pipeline e.g. as arguments to functions, or
LIKEcan take anESCAPEargument which is a single character - see this test. Query checks that it can interpret each argument (in this case a single character) - if it fails to find a type mapping for that type then it assumes it cannot generate literals for that type.We should remove the entry in
_clrTypeMappingsforSqlServerTypeMapperforcharso that we will generate the correct error if someone tries to create a property of that type. But we need to provide an alternate means to translate the literal above. We discussed:LIKEto enforce that theESCAPEargument is a string, orstringTypeMapping if acharone does not exist.