I have this LINQ query and I need to make a second Join to it:
var linqQuery = (from r in gServiceContext.CreateQuery("opportunity")
join c in gServiceContext.CreateQuery("contact") on ((EntityReference)r["new_contact"]).Id equals c["contactid"] into opp
from o in opp.DefaultIfEmpty()
where ((EntityReference)r["new_channelpartner"]).Id.Equals(lProfileProperty.PropertyValue) && ((OptionSetValue)r["new_leadstatus"]).Equals("100000002")
select new
But I need to also Join this:
from r in gServiceContext.CreateQuery("annotation")
join c in gServiceContext.CreateQuery("opportunity") on ((EntityReference)r["objectid"]).Id equals c["opportunityid"]
Sorry, I’m sure this is easy. I suck at LINQ though. Any help would be great.
Thanks!
It’s not really clear what you mean, but I suggest you want:
It’s not clear why you have to cast to
EntityReferenceeverywhere and access fields via their names as strings, by the way. Are you sure you can’t use something like: