Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on Bar.Id equals Foo.BarId1 or Bar.Id equals Foo.BarId2
- var data = (from f in Foos
- join b in Bars on f.BarId1 equals b.Id into tb
- from xb in tb.DefaultIfEmpty()
- join b in Bars on f.BarId2 equals b.Id into tb2
- from xb2 in tb2.DefaultIfEmpty()
- select new { Foo = f, Bar1 = xb, Bar2 = xb2 });
- var data = from f in Foos
- from b in Bars.Where(x => x.Id == p.BarId1 || x.Id == p.BarId2).DefaultIfEmpty()
- select new { Foo = p, Bars = b };
- Foo Bar
- f1 b1
- b2
- Foo Bar
- f1 b1
- f1 b2
- var data = from f in Foos
- select new
- {
- Foo = f,
- Bar1 = Bars.FirstOrDefault(x => x.Id == f.Bar1Id),
- Bar2 = Bars.FirstOrDefault(x => x.Id == f.Bar2Id)
- };
- var data = (from f in Foos
- join b in Bars on f.BarId1 equals b.Id into tb
- from xb in tb.DefaultIfEmpty()
- join b in Bars on f.BarId2 equals b.Id into tb2
- from xb2 in tb2.DefaultIfEmpty()
- select new { Foo = f, Bar1 = xb, Bar2 = xb2 });
- from f in Foos
- select new { f, f.Bar1, f.Bar2 }
- var data = from f in Foos
- from b in Bars
- where f.Id == b.BarId1 || f.Id == b.BarId2
- select new { Foo = p, Bars = bx };
Add Comment
Please, Sign In to add comment