Good night, guys.
I was developing software and started thinking about how best to implement Repository Pattern.
I have to return to the data controller of cities and states, so I have two models in my application.
public class Estado
{
public int Id { get; set; }
public string Nome { get; set; }
public string Uf { get; set; }
public virtual ICollection<Cidade> Cidades { get; set; }
}
public class Cidade
{
public int Id { get; private set; }
public string Nome { get; set; }
public string Uf { get; set; }
public int IdEstado { get; set; }
public virtual Estado Estado { get; set; }
}
Then I use MVC, for it I access the services and services, the repositories ... I started thinking then, would it be better to use an EnderecoService and within it add the state and city repositories? Or Create StateService and CityService? Or even use EnderecoService, but inside also have an EnderecoRepository that would return me States and Cities?
I would like to hear from you, how do you see the best approach and why.
Thank you!