03 January 2011

LINQ - Left outer join

Left outer join in LINQ where the right table references the left table:
Source

result = from o in orders
         join c in coupons on o.Id equals c.Order.Id into c2
         from c3 in c2.DefaultIfEmpty()
         select new ContactCoupon() {
           Contact = o.Contact,
           Coupon = c3
         };

No comments:

Post a Comment