当通过实体框架查询数据库时,是否有排除对象属性值列表的方法?实体框架 - 排除值列表
我试图滑头拉这个数字:
List<String> StringList = new List<String>();
StringList.Add("ya_mama");
StringList.Add("has");
StringList.Add("fleas");
servicesEntities context = new servicesEntities();
var NoFleasQuery = (from x in context.person
where !StringList.Any(y => y.CompareTo(x.the_string_I_dont_want_it_to_be) == 0) // <--- the part where I thought I was slick
select x);
它编译,但之后,我跑了它,它给了我这个错误:
Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
“闭合型”?我的关闭如何!实体框架......你伤了我的心。
它给了我这个数字: LINQ to Entities不识别方法'Boolean Contains(System.String)'方法,并且这个方法不能被转换成存储表达式。 – 2009-11-16 09:27:52