我正在使用 Linqpad 并设置了 odata 连接。我有一个查询如下
QUERY1
void Main()
{var a = from cpuid in Computers
where cpuid.DnsHostName == "xyz"
select new {
ID = cpuid.TechnicalProductsHosted.Select (x => new { Id = x.Id }),
System_Dept = cpuid.SystemDepartment,
};
Console.WriteLine(a);
}
输出:它返回 4 个 id,但一个部门在所有 4 个 id 中是通用的。当我以其他方式查询时,即
QUERY2
var a = from id in TechnicalProducts
where id.Id == "ID-15784"
select new
{System_Dept = id.Computers.Select(x => x.SystemDepartment),
Support_Team = id.Computers.Select(x => x.SupportTeam)
};
Console.WriteLine(a);
输出:id 的 4 个部门。我希望在第一种情况下拥有整个部门列表。这怎么可能?在查询 1 中,我可以将 id 作为 System Department 的输入并以某种方式查询吗?
输出样本