I am trying to write a fairly complex query. Here is what I have:
ClassA{
public ICollection<ClassB> classBObjects {get; set;};
}
ClassB{
public string Name {get; set;}
public string Value {get; set;}
public bool IsVisible {get; set;}
}
While getting the list of ClassA objects, I need to check the collection property (classB objects) against IEnumerable params and only get those ClassA objects along with the list of ClassB objects that have a match.
So if I have :
objectA1
objectB1 {name="X", value="1", true}
objectB2 {name="Y", value="2", true}
objectB3 {name="Z", value="3", true}
objectA2
objectB1 {name="W", value="4", true}
objectB2 {name="X", value="1", true}
params{
name="X", value="1",
name="Y", value="2"
}
I should get back:
objectA1
objectB1
objectB2
objectA2
objectB2
I am wondering if IntersectBy may help me achieve the result I am looking for but not quite sure how to form the query.
Also, I believe this will have to be in-memory computation:
var objectAList = context.ClassA.AsEnumerable();
so probably not so performant?
Any help will be appreciated. Thanks!
AZeus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.