c# - Entity Framework Contains/In Clause with SQLCE -


i trying select items sqlce table, field exists in string array. easy in sql with:

select *  tablex somefield in ([comma delimited array values]); 

i having difficult time transposing linq. following logically work, receiving error: linq entities not recognize method 'boolean contains[string](system.collections.generic.ienumerable`1[system.string], system.string)' method, , method cannot translated store expression.

var result = c in db.tablex              somestringarray.contains(c.somefield)              select c; 

please let me know if has ideas or advice.

thanks!

update:

the following, reccomended below, throws notsupportedexception, error message, class x class calling enumeration: unable create constant value of type 'namespacex.classx'. primitive types ('such int32, string, , guid') supported in context.

var result = c in db.tablex              somestringarray.any(s => s == c.somefield)              select c; 

try

var result = c in db.tablex              somestringarray.any(s => s == c.somefield)              select c; 

please mark answer if solves problem.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -