I was using the DDD Model with Repositories and with 3 layers of data, (with% of%,% with% and% with of%), with the help of some users here I decided to change the project and now I've finished removing 2 layers to Serviço
and Repositorio
of my project.
I'm still studying on this subject that is becoming clearer to me (now I understand why my code was long-winded, as said by the user @ jbueno), I have my context declared and I'm using the 6.0 version of EntityFramework.
I created a controller in my Dominio
layer and did the following search:
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 did not bring the client,
This is my class serviço
:
public class Cliente : Pessoa
{
public string FacebookFoto { get; set; }
public ICollection<TokenCliente> TokensCliente { get; set; }
}
My class repositório
:
public class MensagemUnidade
{
public virtual Cliente Cliente { get; set; }
public virtual Unidade Unidade { get; set; }
}
LazyLoading is enabled, it loads the Web
Correct but the Client gets Cliente
.
I was with the DDD model and using MensagemUnidade
, my project now has the following structure, a ClienteId
layer, a null
layer (where my Repositorio
is and my layers Dominio
, when I changed the project I was in doubt about Infra
and things like, now everything is fitting better, but I still have this problem.