Hi,
If I create an extension method for my entity objects and try to use it in a LINQ-expression I get an error. Is this a limitation and something I cant do or am I missing something?
regards Freddy
Hi,
If I create an extension method for my entity objects and try to use it in a LINQ-expression I get an error. Is this a limitation and something I cant do or am I missing something?
regards Freddy
The problem is that the LINQ-to-Entities provider will attempt to convert your extension method to a SQL statement. LINQ-to-Entities effectively requires that an entire LINQ query expression be translatable to SQL (note that LINQ-to-SQL does not have this limitation; LINQ-to-Entities draws a firm line between client space and server space whereas LINQ-to-SQL is looser). Depending on your extension method, this likely can not be done. That is, if there are any method invocations etc. that can not be translated to SQL to work as a query on server side, forget it.