string[] userIds = userList.Split(','); // is an array of integers
IList<User> users = (from user in this.repository.Users
where userIds.Contains(user.Id.ToString())
select user).ToList();
上面的查询给出
System.NotSupportedException: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
我能做些什么?
use 可以使用这样的东西,
where userIds.Contains(SqlFunctions.StringConvert((double)user.Id))
代替where userIds.Contains(user.Id.ToString())
这应该有效
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)