I’m trying to write a Linq statement that allows me to return a distinct list of
obj1 objects that contain obj2.sID == ASpecified# or obj3.sID == ASpecified#.
I tried to included an example of my entity diagram in hopes that my question would make more sense, but alas I do not have enough reputations. So I guess I will just need to do it in code. Below are my objects.
public class obj1
{
public int obj1_id { get; set; }
public String obj1Prop1 { get; set; }
public String obj1Prop2 { get; set; }
public List<obj2> obj2List { get; set; }
public List<obj3> obj3List { get; set; }
}
public class obj2
{
public int obj2_id { get; set; }
public String obj2Prop1 { get; set; }
public String obj2Prop2 { get; set; }
public Int32 sID { get; set; }
}
public class obj3
{
public int obj3_id { get; set; }
public String obj3Prop1 { get; set; }
public String obj3Prop2 { get; set; }
public Int32 sID { get; set; }
}
I am fairly proficient with simple linq statements but am a little out of my league with this one. I am thinking that I will need to join obj3 and obj2 by the sID but am unsure.
Any help or direction would be appreciated.
Join is not needed.
Try following code snippet