0

I have 3 tables

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)

My question is simple: how do I get a join list of all the columns of the 3 tables using LINQ?

bluish
  • 26,356
  • 27
  • 122
  • 180
dtjmsy
  • 2,664
  • 9
  • 42
  • 62

1 Answers1

0

I figure out how to join results of several tables, this is an example, you can join as many tables as wished.

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();
bluish
  • 26,356
  • 27
  • 122
  • 180
dtjmsy
  • 2,664
  • 9
  • 42
  • 62