I need to compare strings using string.CompareOrdinal(...) inside linq query.
string max; string min; var res = db.Table .Where(c => string.CompareOrdinal(c.Id, min) >= 0) .Where(c => string.CompareOrdinal(c.Id, max) <= 0) .ToList();
The code throws an exception:
LINQ ti Entities do not reconstruct the 'Int32 CompareOrdinal (System.String, System.String)' method, and this method cannot be translated into a storage expression.
There is a lot of data in the table, so I really need a where clause.
Is there any way around this?
Update
I do not try if the two lines are equal - case sensitive or not.
I am trying to determine if a string is within range. So quistion
- Is there a way to do this - does it work with L2E?
Obviously I cannot use string.CompareOrdinal
source share