c# - Performing SQL "in" equivalent in EF -


i have 2 rateable objects e , s, s contained within e e.s , both use same object r rated; r have 1 rated object @ time if r.e.hasvalue == true r.s.hasvalue never true.

i have r objects database , have e. lambda expression rs r.s in e.s??



update
found msdn documentation says:

referencing non-scalar variables, such entity, in query not supported. when such query executes, notsupportedexception exception thrown message states "unable create constant value of type entitytype. primitive types ('such int32, string, , guid') supported in context."

so... can't use a-dubb's answer since query reads

r.where(r => r.sid.hasvalue).where(r => e.s.contains(r.s)) 

which results in notsupportedexception... still have property r.sid of type int? how query e.s ids?

p.s. e.s. of type entitycollection.

i in clauses represented call contains. example

public class r {    public int id {get; set;} }  public ienumerable<r> inclause(ienumerable<int> ids) {    var subset = ids.tolist();     return dbcontext.query<r>.where(r => subset.contains(r.id)); } 

i know that's not exact api call in ef, should set basis solution. maybe know how generate in clauses figure if did presumably wouldn't stuck. if in clause isn't difficult part of query is? maybe piece of business logic mentioned? again, c# object model help.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -