我有3张桌子
T1: id1, col1 (id1 is primary key)
T2: id2, id1, col2 (id1 here is external key from T1)
T3: id3, id1, col3 (id external key of T1)
我的问题很简单:如何使用LINQ获取3个表中所有列的连接列表?
答案 0 :(得分:0)
我弄清楚如何连接几个表的结果,这是一个例子,你可以加入尽可能多的表。
var a = (from s in _DBEntities.Services
join d in _DBEntities.Departements on s.se_id_departement equals d.id_departement
join i in _DBEntities.SsCategoriesServices on s.se_id_sscategorieService equals i.id_SsCategorieService
select new Services
{
IdService = s.id_service,
Adresse = s.adresseService,
NomSousCategory = i.libelleSsCategorieService,
NomDepartement = d.nom,
}).ToList();