2 回答
TA贡献1848条经验 获得超2个赞
你想要下面的东西:
var details = (from dtg in _context.DeviceTypeGroups
join dt in _context.DeviceTypes on dtg.Key equals dt.DeviceTypeGroup.Key into dtgleft
from dtgrecs in dtgleft.DefaultIfEmpty()
join pr in _context.Peers on dtgrecs.Key equals pr.DeviceTypeGroup.Key into peerleft
from peerleftRecs in peerleft.DefaultIfEmpty()
select new
{
dtg.Key,
dtg.Name,
dtg.DeviceTypes,
dtg.Peers
}).ToList();
TA贡献1871条经验 获得超8个赞
这就是我通过使用解决它的方式AutoMapper
var devicetypegroups = await _context.DeviceTypeGroups .Include(b => b.DeviceTypes) .Include(p => p.Peers) .ToListAsync(); var model = _mapper.Map<IEnumerable<DeviceTypeGroupDto>>(devicetypegroups);
:)
- 2 回答
- 0 关注
- 103 浏览
添加回答
举报