Linq到多个实体包括但只选择一个关系

Linq到多个实体包括但只选择一个关系,linq,entity-framework,linq-to-entities,Linq,Entity Framework,Linq To Entities,我有以下Linq(lambda)表达式: public IEnumerable<SetupShift> GetEmployeeShift(int employeeId) { var shifts = DbContext.Set<Employee>() .Include(em=> em.SetupShiftCode.SetupShifts) .Where(em=&g

我有以下Linq(lambda)表达式:

public IEnumerable<SetupShift> GetEmployeeShift(int employeeId)
        {
            var shifts = DbContext.Set<Employee>()
                .Include(em=> em.SetupShiftCode.SetupShifts)
                .Where(em=> em.EmployeeId == employeeId)
                .Select(em => em.SetupShiftCode.SetupShifts).ToList();

            return shifts;
        }
public IEnumerable GetEmployeeShift(int-employeeId)
{
var shifts=DbContext.Set()
.Include(em=>em.SetupShiftCode.SetupShifts)
.Where(em=>em.EmployeeId==EmployeeId)
.Select(em=>em.SetupShiftCode.SetupShifts).ToList();
返回班次;
}
员工有一个轮班代码(说明),而一个轮班代码有许多轮班设置(收集时间等)

我只想返回SetupShift,但当我将鼠标移到ToList()上时返回;结果是
List
,而不仅仅是
List


有线索吗

使用
SelectMany
而不是
Select

var shifts = DbContext.Set<Employee>()
            .Include(em=> em.SetupShiftCode.SetupShifts)
            .Where(em=> em.EmployeeId == employeeId)
            .SelectMany(em => em.SetupShiftCode.SetupShifts).ToList();
var shifts=DbContext.Set()
.Include(em=>em.SetupShiftCode.SetupShifts)
.Where(em=>em.EmployeeId==EmployeeId)
.SelectMany(em=>em.SetupShiftCode.SetupShifts).ToList();