I have three classes:
class Cbo
{
public string ProfId { get; set; }
public string Cbo { get; set; }
public string Descricao { get; set; }
}
class Profissional
{
public string ProfId { get; set; }
public string NomeProf { get; set; }
}
class Vinculo
{
public string UnidadeId { get; set; }
public string ProfId { get; set; }
public string Cbo { get; set; }
public string NomeProf { get; set; }
public string Descricao { get; set; }
}
I need to create a list using LINQ:
select * from Cbo, Profissional, Vinculo where
Cbo.ProfId = Profissional.ProfId and
Vinculo.ProfId = Profissional.ProfId
I can do with two tables like this:
List<Vinculo> result = (from vinculo in listaVinculo join profissional in listaProfissional on vinculo.ProfId equals profissional.ProfId
select new Vinculo()
{
Cbo = vinculo.Cbo,
NomeProf = profissional.NomeProf,
ProfId = profissional.ProfId,
UnidadeId = vinculo.UnidadeId
}).ToList();
With this code I bind the Profissional
and Vinculo
classes, but I still do not know how to include the Cbo
class to get the descricao
field.