Only primitive types or enumeration types are supported in this context (in Linq Contains method) -
i have linq entities query having trouble with.
var query = (from q in dc.table1 (from in dc.table2 select a.typeid).contains(q.typeid) select q);
this query valid in linq sql. should produce sql query this:
select * table1 typeid in (select typeid table2)
the error thrown suggests linq entities "unable create contstant value of type "table2"
i following:
var typelist = (from q in dc.table2 select q.typeid).tolist(); var query = (from q in dc.table1 typelist.contains(q.typeid) select q);
but produce 2 sql queries instead of 1:
select distinct typeid table2; select * table1 typeid in (1,2,3,4,5,6..... etc......);
any ideas
i tried query , worked:
var result = (from appgroup in test.appgroupthemes (from t in test.themes select t.id ).contains(appgroup.themeid) select appgroup).tolist(); console.writeline(result.count);
Comments
Post a Comment