var ps = dbContext.SplLedgers.Select(p => new SplLedgerModel
{
Name = p.Name,
VoucherType = Convert.ToString(((JIMS.VoucherTypes)p.VoucherType))
});
我收到以下异常,代码有什么问题。LINQ to Entities无法识别该方法,并且此方法无法转换为商店表达式
JIMS.VoucherType是一个枚举
+ $exception {"LINQ to Entities does not recognize the method 'System.String ToString(System.Object)' method, and this method cannot be translated into a store expression."} System.Exception {System.NotSupportedException}
好链接讨论这个问题:http://social.msdn.microsoft.com/Forums/en/adodotnetentityframework/thread/19a33909-c532-419b-a533-57e431c0b30b – dugas