Linq离开了外部联盟并逐个发布

时间:2014-01-08 13:52:27

标签: linq group-by left-join

您好我以下所有查询都会返回如下结果:

lstView.DataSource = (from h in context.HolidayMains
                              join hd in context.HolidayDetails  on h.Id equals hd.HolidayMainId into hd2
                              from hd in hd2.DefaultIfEmpty()
                              join e in context.Employees on h.CreatedBy equals e.Id into e2
                              from e in e2.DefaultIfEmpty()
                              join o in context.OfficeLocations on hd.OfficeLocation equals o.Id into o2
                              from o in o2.DefaultIfEmpty()
                              select new
                              {
                                  h.HolidayTitle,
                                  h.Date,
                                  OfficeLocation = o.Name,
                                  CreatedBy = e.Name,
                                  h.Id
                              }).ToList();

enter image description here

但我需要这样的结果:

enter image description here

怎么做?

0 个答案:

没有答案