當通過實體框架查詢數據庫時,是否有排除對象屬性值列表的方法?實體框架 - 排除值列表
我試圖滑頭拉這個數字:
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