我想从 HireGroupDetails 中获取车辆的所有记录,但不知道如何获得 NOT EQUAL LINQ 中的功能!
var fleetHireGroupDetailQuery = from vehicle in db.Vehicles
join hgd in db.HireGroupDetails on
new { vehicle.VehicleMakeId, vehicle.ModelYear }
equals new { hgd.VehicleMakeId, hgd.ModelYear}
select new RptFleetHireGroupDetail
{
PlateNumber = vehicle.PlateNumber,
};
答案 0 :(得分:0)
我认为这就是你所需要的:
var fleetHireGroupDetailQuery = from vehicle in db.Vehicles
where !(from hgd in db.HireGroupDetails
select new { hgd.VehicleMakeId, hgd.ModelYear}).Contains(new { vehicle.VehicleMakeId, vehicle.ModelYear })
select new RptFleetHireGroupDetail
{
PlateNumber = vehicle.PlateNumber,
};