我有四个表/类
public Class Brands
{
public int Id {get;set;}
public string Brand {get;set;}
public String BrandType {get;set;}
}
public Class ManufactureA
{
public int Id {get;set;}
public int BrandsId {get;set;}
public string Product {get;set;}
public int Distributor {get;set;}
}
public Class ManufactureB
{
public int Id {get;set;}
public int BrandsId {get;set;}
public string Product {get;set;}
public int Distributor {get;set;}
}
public Class ManufactureC
{
public int Id {get;set}
public int BrandsId {get;set;}
public string Product {get;set;}
public int Distributor {get;set;}
}
public Class ManufactureD
{
public int Id {get;set;}
public int BrandsId {get;set;}
public string product {get;set;}
public int Distributor {get;set;}
}
我正在尝试制作一个表格,显示品牌及其相关制造商的信息。例如:
品牌1:
产品A,经销商A
品牌2:
产品B,分销商B
品牌3:
产品C、分销商C
品牌4:
产品D、分销商D
所以我从这段代码开始,但在决定如何实际分组或投影它时感到困惑:
var allBrandsManufactures = from brand in Brands
join factoryA in ManufactureA on factoryA.BrandsId equals brand.Id
join factoryB in ManufactureB on factoryB.BrandsId equals brand.Id
join factoryC in ManufactureC on factoryC.BrandsId equals brand.Id
join factoryD in ManufactureD on factoryD.BrandsId equals brand.Id