Suppose we have
var i = 5; //int parameter from closure
c.CustomerID which is mapped in database as nchar(5)
and when you have c.CustomerID + i in expression tree, we try to infer type.
- Should type of parameter i be
nchar(5)?
- what if the value does not fit in length 5?
- What should be type of resulting expression?
- It cannot be
nchar(5) because result of concatenation would be larger than that.
- The translation generates this
[c].[CustomerID] + CAST(@__i_0 AS nchar(5)) so we need to figure out exact type to use for casting purposes.
Few ideas around
- Ignore length facets for string?
- Ignore Fixed length too?
Suppose we have
var i = 5; //int parameter from closurec.CustomerIDwhich is mapped in database asnchar(5)and when you have
c.CustomerID + iin expression tree, we try to infer type.nchar(5)?nchar(5)because result of concatenation would be larger than that.[c].[CustomerID] + CAST(@__i_0 AS nchar(5))so we need to figure out exact type to use for casting purposes.Few ideas around