I am using Linq to Entity Framework 4, what I'm trying to do is build a query that finds all supplier entities that do not start with a letter, typically these are numbers, e.g. "1st Choice" I thought this would be trivial and wrote this:
var letters = Enumerable.Range('A', 26).Select(x => (char)x);
var results = from supplier in All()
where !letters.Contains(supplier.Name[0])
select supplier;
return results.ToList();
Unfortunately this fails with the error:
System.NotSupportedException`
"Unable to create a constant value of type 'System.Char'.
Only primitive types ('such as Int32, String, and Guid') are supported in this context."
Irritatingly this same query works fine in LinqPad as a Linq To Sql query. How can I get around this?