I have a class with a nullable int property that that for filtering reasons, I need to convert to a string to do some comparisons. I have EF 6.1.2 installed, so using a .ToString() will work for that.
queryableData = queryableData.Where(a =>
a.PropName.HasValue && a.PropName.Value.ToString().Contains("8675309"));
When examining the actual SQL being executed, the number is being CAST into an NCLOB type, which is resulting in the following error:
ORA-00932: inconsistent datatypes: expected NCHAR - got NCLOB
From what I've read, this is because Entity is unaware of the potential max size in this case, so it defaults to the largest option. I know with a string property that I would be able to denote a max size to help. Is there anything that I can do while keeping the property as an int to prevent the NCLOB's from being used? Or a way to use them while preventing this exception?
Some other notes:
- I'm on an Oracle System, so SqlFunctions.StringConvert is out.
- I'm on Odp.net version 12.x (related to this post).
- The EF is a Model-First approach.
- The .Where() clause is being added to an AsQueryable(), so I can't do anything in memory.