有没有一种方法可以在通过实体框架查询数据库时排除对象属性的值列表?
我试图聪明地提取这个数字:
我试图聪明地提取这个数字:
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);
代码编译通过,但运行时出现以下错误:
无法创建“闭包类型”常量值。在此上下文中只支持原始类型(如 Int32、String 和 Guid)。
“闭包类型”??我的闭包呢!Entity Framework……你伤了我的心。