I have a column that's defined as an integer in EF (Code First). I want to search it using "starts with." Now, I can do this:
Where(x => SqlFunctions.StringConvert((double)x.AccountNumber).StartsWith(searchTerm))
However, SqlFunctions.StringConvert()
gets translated to the T-SQL function STR()
, which left-pads the result for reasons which are beyond my comprehension.
Also, I can't use string.TrimStart()
because it's not supported by the Entity Framework.
Can anyone lend any help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…