2
I have the following entities:
public class Rota
{
    public Rota()
    {
        CidadesRotas = new List<CidadesRota>();
    }
    public int RotaId { get; set; }
    public string Descricao { get; set; }
    public string Observacao { get; set; }
    public bool Ativo { get; set; }
    public virtual ICollection<CidadesRota> CidadesRotas { get; set; }
}
public class Cidade
{
    public Cidade()
    {
        CidadesRotas = new List<CidadesRota>();
    }
    public int CidadeId { get; set; }
    public string Nome { get; set; }
    public virtual Estado Estado { get; set; }
    public virtual ICollection<CidadesRota> CidadesRotas { get; set; }
}
public class CidadesRota
{
    public int CidadeId { get; set; }
    public int RotaId { get; set; }
    public bool Ativo { get; set; }
    public Cidade Cidade { get; set; }
    public Rota Rota { get; set; }
}
When I perform a route search for an ID, I need each item on my Cityshow list to be filled in with their respective cities. I know you can use Entity’s Include, but I don’t know how to use it from a list item.
In the following example, return me a route with a city list:
var query = _context.Rota
            .Include(r => r.CidadesRotas)
            .Where(r => r.RotaId == RotaId);
Doubt: It is possible to bring each item from the list of cities?
thank you, I’ll test...
– Rafael Arthur