3
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 it 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 unite the classes Profissional
and Vinculo
, but I still don’t know how to include the class Cbo
to take the field descricao
.
Is using ORM?
– gato
hi, I’m new to C# and can’t tell if I’m using ORM
– Italo Rodrigo