0
In my application I have some entities and from some statements of each need to perform a query in the database and display these statements cohesive in a grid. I am working with ASP.Net MVC 4 and my application is divided into layers: VO, BO, DO
I’ll try to give a more brief example of the difficulty I’m having. Look at the entities below:
class Cliente
{
public int IdCliente { get; set; }
public string NomeCliente { get; set; }
}
class Usuario
{
public int IdUsuario { get; set; }
public string NomeUsuario { get; set; }
}
class ChamadoTecnicoStatus
{
public int IdChamadoTecnicoStatus { get; set; }
public string DescricaoChamadoTecnicoStatus { get; set; }
}
class ChamadoTecnico
{
public int IdChamadoTecnico { get; set; }
public DateTime DataChamadoTecnico { get; set; }
public int IdChamadoTecnicoStatus { get; set; }
public string InformacaoChamadoTecnico { get; set; }
public int IdCliente { get; set; }
public int IdUsuario { get; set; }
}
What I will need is to make a select in the bank and bring the reports as below:
IdChamadoTecnico | DataChamadoTecnico | DescricaoChamadoTecnicoStatus | InformacaoChamadoTecnico | NomeCliente | NomeUsuario
I believe I could easily resolve this if I return to my presentation layer one DataTable
but that’s exactly what I didn’t want to do. I wanted my method to return me only one List<objeto>
only this way I would have to have this entity:
class EntidadeParaListaDeChamadosTecnicos
{
public int IdChamadoTecnico { get; set; }
public DateTime DataChamadoTecnico { get; set; }
public string DescricaoChamadoTecnicoStatus { get; set; }
public string InformacaoChamadoTecnico { get; set; }
public string NomeCliente { get; set; }
public string NomeUsuario { get; set; }
}
And this I totally believe is not recommended to do.
What is the best practice? I’m looking for some Pattern but I haven’t found anything.
Hello, welcome to [en.so]. Please use formal Portuguese, accentuating everything you can and know. Your keyboard has
ç
and~
, nay?– brasofilo
@Marcelo You are using Entity Framework?
– Leonel Sanches da Silva