I am getting an exception when I execute this code:
var result = from menu in menuBus.GetMenus()
orderby menu.InternalName
select new
{
Value = menu.ID.ToString(),
Text = menu.InternalName
};
var result = allMenus.ToList();
The error message says: LINQ to Entities does not recognize the method ‘System.String ToString()’ method, and this method cannot be translated into a stored expression.
So, I guess that something goes wrong with Value = menu.ID.ToString(). The ID property is defined as GUID (UniqueIdentifier in MS SQL).
Does anybody have a solution for this?
Thank you very much!!!
You need to run the list through another query after querying the database.