c# - Return entities after intersecting with list of web controls using LINQ -
i can use following return ids (strings) match following intersect:
var ids = db.questionoption .select(a => a.controlid) .intersect(cs.select(b => b.clientid)) .tolist();
how intersect ids fetch entity, not matching id?
first can ids
:
var idlist = cs.select(b => b.clientid);
then can use contains
this:
var result = db.questionoption.where(a => idlist.contains(a.controlid)).tolist();
or, can use join
:
from q in db.questionoption join x in cs on q.controlid equals x.controlid select q
Comments
Post a Comment