C# – Entity Framework ToString method

clinq-to-entities

Following code block throws error.

LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.

db.tbOnIgmHawbDetails
  .Where(s => !db.tbImpoExaminations.Any(x => x.Hawb.ToString() == s.Hawb) && s.AwbNo == p)
  .Select(s => s.Hawb).ToList();

Any suggestion? why this happen and what is the solution?

Best Answer

.ToString() is supported properly going forward with EF 6.1: http://blogs.msdn.com/b/adonet/archive/2014/03/17/ef6-1-0-rtm-available.aspx