首页 > 代码库 > EntityFramework left join

EntityFramework left join

   var result = from u in db.Order
                             join n in db.Equipment on u.OrderId equals n.OrderId into temp
                             from m in temp.DefaultIfEmpty()
                             select new
                             {
                                 OrderID = u.OrderId,
                                 Customername = u.Customername,
                                 EId = m == null "" : m.EId.ToString(),
                                 Price = m == null ? 0 : m.Price
                             };