【发布时间】:2009-11-16 09:15:44
【问题描述】:
通过实体框架查询数据库时,有没有办法排除对象属性的值列表?
我试图狡猾地拉这个号码:
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”)。
'闭合类型'??我的关闭怎么样!实体框架……你伤了我的心。
【问题讨论】:
标签: c# entity-framework