我在执行这段代码时遇到了异常:
错误提示是:LINQ to Entities 不认识方法 'System.String ToString()',因此该方法无法转换为存储表达式。
因此,我猜测 Value = menu.ID.ToString() 出现了问题。ID 属性被定义为 GUID(在 MS SQL 中为 UniqueIdentifier)。
有人有解决方案吗?
非常感谢!
var result = from menu in menuBus.GetMenus()
orderby menu.InternalName
select new
{
Value = menu.ID.ToString(),
Text = menu.InternalName
};
var result = allMenus.ToList();
错误提示是:LINQ to Entities 不认识方法 'System.String ToString()',因此该方法无法转换为存储表达式。
因此,我猜测 Value = menu.ID.ToString() 出现了问题。ID 属性被定义为 GUID(在 MS SQL 中为 UniqueIdentifier)。
有人有解决方案吗?
非常感谢!