У меня есть следующий оператор LINQ, который выдает следующую ошибку
Ошибка при вводе типа при вызове присоединения к группе
var EmployeeList = (from requestemployee in _context.BulkTransportRequestEmployees
join request in _context.BulkTransportRequests on requestemployee.BulkRequestBulkRequestId equals request.BulkRequestId
join employee in _context.Employees on requestemployee.EmployeeEmployeeId equals employee.EmployeeId
join deptemp in _context.EmployeeDepartments on employee.EmployeeId equals deptemp.EmployeeEmployeeId
join dept in _context.Departments on deptemp.DepartmentDepartmentId equals dept.DepartmentId
//Error is in here
join routepath in _context.RootPaths on new { Key1 = requestemployee.CityCityId, Key2 = requestemployee.RootRootId } equals new { Key1 = routepath.CityId, Key2 = routepath.RootId } into join_routepath
from routepath in join_routepath.DefaultIfEmpty()
join route in _context.Roots on routepath.RootId equals route.RootId
join destination in _context.Cities on routepath.CityId equals destination.CityId
join pass in _context.TransportPasses on employee.EmployeeId equals pass.IssuedToEmployeeId into join_employee_pass
from pass in join_employee_pass.DefaultIfEmpty()
where deptemp.IsDefaultDepartment == true &&
request.RequestType == 1 &&
employee.EmployeeType == emptype &&
DbFunctions.TruncateTime(request.TripDateAndTime) >= DbFunctions.TruncateTime(FromDate) &&
DbFunctions.TruncateTime(request.TripDateAndTime) <= DbFunctions.TruncateTime(ToDate) &&
(pass.IsHold == true || pass.IsCanceled == true || pass.IssuedDate == null || pass.PassType == 1)
group new { employee, request, routepath } by new
{
dept.DepartmentName,
employee.EmployeeId,
employee.EmpCode,
employee.EmployeeCallingName,
employee.EmployeeSurname,
employee.NameWithInitials
} into g
select new
{
g.Key.EmployeeId,
g.Key.EmpCode,
Employee = g.Key.EmployeeCallingName + " - " + g.Key.NameWithInitials,
g.Key.DepartmentName
}).ToList();
requesttemployee ключи являются обнуляемыми типами. Так как же я могу sh присоединиться к этой группе без ошибок?