Replacing method calls with expressions at runtime with Linqkit and the Entity Framework
LINQ to Entities does not recognize the method ‘…’ method, and this method cannot be translated into a store expression. Does this sound familiar to you? It’s a common issue that many developers face, as evidenced by the astronomical amount of questions about it on stackoverflow.com The problem To understand why this happens, you must first realize that Linq To Entities - the thing that produces the SQL statements for you - never really executes your C# code. So when you write: ...