LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and th

Posted siyunianhua

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and th相关的知识,希望对你有一定的参考价值。

if (!string.IsNullOrEmpty(FarmWorkId))
{
data = data.Where(p => p.TypeId == Convert.ToInt32(FarmWorkId));
}

 

解决方法:

if (!string.IsNullOrEmpty(FarmWorkId))
{
int i = Convert.ToInt32(FarmWorkId);
data = data.Where(p => p.TypeId == i);
}

以上是关于LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and th的主要内容,如果未能解决你的问题,请参考以下文章

LINQ to Entities does not recognize the method , and this method cannot be translated into a store e

LINQ to Entities 中的“NOT IN”子句

typeorm:migration create on New Project Does Not Recognize Entities - “未发现数据库架构更改 - 无法生成迁移。”

为啥 LINQ-to-Entities 将此查询放在子选择中?

Linq-to-Entities:带有 WHERE 子句和投影的 LEFT OUTER JOIN

如果存在-UPDATE-else-INSERT 与 Linq-to-Entities?