我做了一个痣来测试我的存储库类,当我输入 DefaultIfEmpty(new Drivers()) 时它可以工作,但是当我运行程序时,我收到这个错误:查询运算符“DefaultIfEmpty”使用不支持的重载。
但是当我把它放回DefaultIfEmpty()时,它工作正常,但我的*强文本*痣测试现在返回一个空值。这是我的代码:
var result = from p in this.context.AirPositions
join a in this.context.Airplane p.airplane_id equals a.id
join s in this.context.Status on p.status_id equals s.id
join dp in this.context.DriversPositions on p.id equals dp.position_id into dpJoin
from ds in dpJoin.DefaultIfEmpty(new DriversPosition())
join d in this.context.Drivers on ds.driver_id equals d.id into dsJoin
from drs in dsJoin.DefaultIfEmpty(new Driver())
orderby p.timesent descending
select new PositionViewModel()
{ ... };