Given that the models are correctly set-up, that would be quite easy:
var encuestas = context.Encuestas
.Include(x => x.Preguntas.Tema)
For this to work, you would need:
public class Encuesta
{
public virtual ICollection<Pregunta> Preguntas { get; set; }
}
public class Pregunta
{
public Tema Tema { get; set; }
}
public class Tema
{
// not actually needed but for clarification
public virtual ICollection<Pregunta> Preguntas { get; set; }
}
using (DBEntities db = new DBEntities())
{
var user = (from e in db.TD_ENCUESTAS
join p in db.td_preguntas on e.ENC_ID equals p.PRE_ENC_ID
join t in db.TC_TEMAS on p.PRE_TEM_ID equals t.TEM_ID;
select new
{
Name = e.ENC_DESCRIPCION,
Address = p.PRE_ACTIVO,
.....//So on...//
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.