Common Asp.Net Tips and Tricks 3
Introduction This is a series articles on ASP.NET Tips and Tricks. Under my previous article Common ASP.Net Tips and Tricks , we learned configuration tips and tricks. The article explained common exceptions we encounter while development and best practices for code implementation. Tips and Tricks LINQ to Entities does not recognize ToString Sometimes LINQ to Entities does not recognize the method "System.String ToString()" and this method cannot be translated into a store expression. Solution This type of exception frequently occurs when we are working with LINQ or Entity Framework. For example: var result=dc.Tests.Where(i=>i.status==status.ToString()).FirstOrDefault(); According to the preceding syntax, when we convert “status.ToString()”, in the where condition the exception "Expression not found such method in SQL" occurs where the condition returns an IQueryable result. So if we convert the result to IEnumerable, then the