我不知道为什么这不起作用(抛出内部异常)。有人可以帮忙吗?
var flightCrew = from crew in crews
medium inner join flight in flights on crew.Model equals flight.Model
into schedule from flight in schedule.active()
答案 0 :(得分:1)
我不知道中间内部连接是什么。我想你的意思是左联?试试这个:
var flightCrew = from crew in crews
join flight in flights on crew.Model equals flight.Model
into schedule from flight in schedule.DefaultIfEmpty()
select new
{
//the following are sample fields
crew.CrewId,
crew.Name,
FlightName = flight != null ? flight.Name : ""
}
请注意,无论您从flight
获得哪些字段,都 执行空检查。