-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Milestone
Description
There is a continuum of scenarios that can be supported here:
- Allow for simple hard coded conversions between types that are related in a well-know manner to types that are supported. E.g.:
charcan map to the database exactly as astringof size 1 (see Remove SqlServer TypeMapping for CLR type char #8656)bytecan map to the database exactly the same as abyte[]- signed or unsigned small integers can fit in the nearest wider signed or unsigned integer
- Allow providers to supply their own additional type mappings for types they don't support, e.g. if a database engine doesn't have native support for bool, it can decide to use a small integer representation
- Allow specific well known scenarios that are commonly demanded, like mapping enum types to strings
- Allow for conversions to be performed on the server (vs. only on the client) for cases in which there isn't a viable CLR representation for the server type - see Support (custom) member/method translations on value-converted types #10434 and Support server side value conversions #10861
- Allow for user provided conversions
They all probably require extending the reach of the type mapper to be able to participate of the generation of:
- Parameters
- Expressions for value access in materialization
- Expressions for equality and inequality comparisons - see Support client evaluation when store evaluation is not appropriate #10265
- Equality on the server should be equivalent to equality on the client as long as the conversion is deterministic and bijective.
- Order comparisons and sorting - see Support client evaluation when store evaluation is not appropriate #10265
- Comparisons and sorting are equivalent as long as the conversion is a monotonic function (although reversed if it is decreasing)
- For non order-preserving conversions, we may need to differentiate the scenarios in which we introduce sorting just to get the order of two or more results to be deterministic so we can zip them together, vs. explicit ordering requested by user, which we may need to evaluate on the client after the conversion is performed.
- Operator and function translation - see Support (custom) member/method translations on value-converted types #10434
rprouse, jnm2, Misiu, glen-84, snboisen and 46 more