I have 3 tables
Inventarios -> Localizacoes -> Etiquetas all have one to many relation from left to right
Problem is that i cannot seem to reach Etiquetas
// GET: api/Inventarios public IQueryable<Inventario> GetInventarios() { var inventarios = db.Inventarios.Include(i => i.Localizacoes.Select(l => l.Etiquetas.SelectMany(e => e.Numero))); return inventarios; } and here are the models
public class Inventario { public int InventarioID { get; set; } public string Colaborador { get; set; } public string Armazem { get; set; } public decimal Total { get; set; } public DateTime Data { get; set; } public ICollection<Localizacao> Localizacoes { get; set; } } public class Localizacao { public int LocalizacaoID { get; set; } public string Referencia { get; set; } public int EtiquetasPorInventariar { get; set; } public int EtiquetasInventariadas { get; set; } public bool IsValid { get; set; } public decimal Precisao { get; set; } public int InventarioID { get; set; } public Inventario Inventario { get; set; } public ICollection<Etiqueta> Etiquetas{ get; set; } } public class Etiqueta { public int EtiquetaID { get; set; } public string Numero { get; set; } public int LocalizacaoID { get; set; } public Localizacao Localizacao { get; set; } } this is the exception i get on browser console from api request
"The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties."
SelectManydoesn't look right, also that fact you are returning anIQueryableis suspiciousEtiqueta? You don't have anywhereclause.