Allow users to directly express a database cast to a specific store type (EF.Cast)
Open
area-query
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
There are some situations where users might want to directly express `CAST(x AS some_type)`. For database types for which a default CLR mapping already exists (e.g. int), this can already be achieved e.g. via Convert.ToInt32(), but for database types with no default CLR type mapping, this isn't possible.
Note that this is different from #4978 - that issue is about forcing a type mapping on a node, without introducing a CAST in SQL (e.g. to affect the SQL representation of a constant, or the DbType of a parameter).
Use cases:
* Cast a PostgreSQL text to a tsquery (see https://github.com/npgsql/efcore.pg/issues/3336).
Contributor guide
Assessment
This issue has not been assessed yet.