ehs*_*kar 1 c# linq int entity-framework int32
我正在使用Entity Framework,并且有一行代码将字符串字段(id)转换为int并与数字进行比较
students = students.Where(s => (Int32.Parse( s.id)>5555));
Run Code Online (Sandbox Code Playgroud)
每当我尝试运行它时,都会收到rhis错误。“ LINQ to Entities无法识别'Int32 Parse(System.String)'方法,并且该方法无法转换为商店表达式。”
我尝试了几种不同的方法,但没有任何效果,因此任何帮助都将非常有用。
首先,我强烈建议您不要将列转换为int,否则会丢失该列的索引。您宁愿将int转换为字符串。但是,这里是解决代码的方法。
MethodCallTranslator.CallTranslator将接受Convert.ToInt32(string)并替换为的新内容(int) string。MethodCallTranslator.CallTranslator的MethodCallTranslator。| 归档时间: |
|
| 查看次数: |
1987 次 |
| 最近记录: |