Friday, August 24, 2012
Lightswitch and Left Outer Join
Ever needed to do a left outer join in a lightswitch App using linq? Yes, well its pretty simple. Just add .DefaultIfEmpty() to any join object that requires the left outer.
query = from pp in query
from pbl in pp.ProjectBusinessLines.DefaultIfEmpty()
from s in pbl.ProjectBusinessLineServices.DefaultIfEmpty()
where pp.ProjectSummary.Contains(KeyWordSearch)
|| pp.CompanyName.Contains(KeyWordSearch)
|| pp.ProjectName.Contains(KeyWordSearch)
|| pbl.OurRole.Contains(KeyWordSearch)
|| pp.Location.Contains(KeyWordSearch)
|| s.Service.ServiceName.Contains(KeyWordSearch)
select pp;
Subscribe to:
Post Comments (Atom)
Works like a charm :-)
ReplyDelete