I've got some collections of data objects that can't directly be accessed from one another. I imagine the best solution would be to get the database guys to make a query for this, but in the meantime, is there some way to tighten this up?
var conflicting = allFoos.Where(foo => foo.ElectronicSerialNumber != 0
&& foo.BarID != interestingBar.ID)
.Join(fooInfoCollection, foo => foo.ElectronicSerialNumber,
fooInfo => fooInfo.ElectronicID,
(foo, fooInfo) => foo)
.Join(allBars, foo => foo.BarID, bar => bar.ID, (foo, bar) => bar)
.Where(bar => bar.SomeCriteria == false)
.FirstOrDefault();
if (conflicting != null)
{
doStuff(conflicting);
}