C# 不支持Linq Contains()
它给了我不支持的例外: LINQ to实体无法识别方法“System.String” Format(System.String、System.Object、System.Object)方法,以及 方法无法转换为存储表达式C# 不支持Linq Contains(),c#,linq,entity-framework,entity,C#,Linq,Entity Framework,Entity,它给了我不支持的例外: LINQ to实体无法识别方法“System.String” Format(System.String、System.Object、System.Object)方法,以及 方法无法转换为存储表达式 有人能告诉我如何解决这个问题吗?如果您对SQL Server使用LINQ to实体,您可以使用: 什么是标识符?它是一个字符串。我对其进行了格式化,使其具有这两个参数,例如“3:com.app.android”。您使用的是EF4还是更高版本?您确定这是正确的代码/错误消息吗?错
有人能告诉我如何解决这个问题吗?如果您对SQL Server使用LINQ to实体,您可以使用:
什么是
标识符
?它是一个字符串。我对其进行了格式化,使其具有这两个参数,例如“3:com.app.android”。您使用的是EF4还是更高版本?您确定这是正确的代码/错误消息吗?错误是由于String.Format而不是Contains引起的。
(from a in GetCtx().Application
where identifiers.Contains(a.os + ":" + a.osIdentifier)
select a.id).ToList();
(from a in GetCtx().Application
where identifiers.Contains(SqlFunctions.StringConvert((double)a.os) + ":" + a.osIdentifier)
select a.id).ToList();