Computer IP
__________________________
PC 1 192.168.2.1
PC 2 192.168.2.2
PC 3 192.168.2.3
Computer Protection Status
__________________________
PC 1 Protected
PC 3 Not Protected
Computer CPU Percentage
__________________________
PC 1 52%
PC 3 23%
Computer Updates
__________________________
PC 2 206
PC 3 127
对返回以下输出的数据集执行LINQ查询:
Computer IP Protection Status CPU Percentage Updates
____________________________________________________________________________
PC 1 192.168.2.1 Protected 52%
PC 2 192.168.2.2 206
PC 3 192.168.2.3 Not Protected 23% 127
var joined = from heartbeat in heartbeats
join protection in protections on heartbeat.Computer equals protection.Computer into protectionJoined
from p in protectionJoined.DefaultIfEmpty()
join perf in performance on p.Computer equals perf.Computer into performaceJoined
from x in performaceJoined.DefaultIfEmpty()
join update in updates on x.Computer equals update.Computer into final
from e in final.DefaultIfEmpty()
select new ServerOverview
{
ComputerName = heartbeat.Computer,
ComputerIP = heartbeat.ComputerIP,
ProtectionStatus = p == null ? null : p.ProtectionStatus,
CPUPercent = x == null ? -1 : x.CPUPercent,
Updates = e == null ? -1 : e.Updates
};
但这缺少了返回缺少列的行:
Computer IP Protection Status CPU Percentage Updates
____________________________________________________________________________
PC 3 192.168.2.3 Not Protected 23% 127