0
I was using the DDD Model with Repositories and with 3 layers of data, (Serviço,Repositorio and Dominio), with the help of some users here I decided to change the project and now I ended up removing 2 layers to serviço and the repositório of my project.
I am still studying on this subject that is becoming increasingly clear to me (now I understand why my code was wordy, as said by @jbueno), I have my context stated and I am using the 6.0 version of Entityframework.
I created a controller in my layer Web and did the following research :
List<MensagemUnidade> mensagens = this.Contexto.MensagemUnidade
.Include(c => c.Cliente).Where(l => l.UnidadeId == unidade.UnidadeAtual && l.OrigemId == (int)enumOrigemMensagem.ADMIN)
.OrderByDescending(l => l.DataEnvio).Skip(mensagemModel.PaginaAtual * 20)
.Take(20)
.ToList();
She didn’t bring the client,
This and my class Cliente:
public class Cliente : Pessoa
{
public string FacebookFoto { get; set; }
public ICollection<TokenCliente> TokensCliente { get; set; }
}
My class MensagemUnidade:
public class MensagemUnidade
{
public virtual Cliente Cliente { get; set; }
public virtual Unidade Unidade { get; set; }
}
The Lazyloading is activated, it even carries the ClienteId Correct but the Client stays null.
I was with the DDD model and using Repositorio, my project now has the following structure, a layer Dominio, a layer Infra(where is mine contexto and my layers Web/API , when I changed the project I was in doubt about UnitofWorkand things like, now it’s all fitting better, but I still have this problem.