LINQ to Entities does not recognize the method...
Guys, I'm sorry. I realize that this issue has been brought up by hundreds of people already. Unfortunately I have been reaching my mental boundaries already and none of the answers I found seemed to match my case.
Here is what I tried to do:
var apiMenuItems = menuItems.Select(item => new ApiMenuItem()
{
ID = item.ID,
Name = item.Name.GetLocalizedString("en")
});
As you can see I want to create a couple new objects of type ApiMenuItem (which is a very simple class).
public class ApiMenuItem
{
public Guid ID { get; set; }
public string Name { get; set; }
}
As far as I understood, Entity Framework needs to convert my LINQ statement to pure SQL. This does not work with my GetLocalizedString(string languageCode) extension method.
Could anybody please help me out with some code that fixes this issue - or works around it? I really can't come up with a solution myself :-(
Thanks so much for your help!