如何将int转换为字符串列?

时间:2013-02-07 08:35:50

标签: c# sql entity-framework

表达式:

 filtrationResult = filtrationResult.Where(string.Format("Convert.ToString({0}).Contains(@0)", filter.Field), filter.Value);

filter.Field是名称列(Int32)

我收到错误:

LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression.

如何正确转换?

1 个答案:

答案 0 :(得分:0)

我创建一个包含filter.Field所有可能值的switch语句,然后使用EF生成的属性。

相关问题