3
I’m trying to make a select in a table that contains several columns and I want the command sql that the Entityframework gera contain only the columns I specified.
My code is like this:
var clientes = (from cliente in repositoryCliente.GetAll()
select new
{
cliente.Id,
cliente.Nome,
cliente.Email,
cliente.Telefone
}).ToList();
And my Pository:
public virtual IEnumerable<T> GetAll()
{
return _dbSet;
}
But when parsing the sql command it does, it searches all other fields (I’m using Entity Framework Profiler)
I want it to execute only the sql command "Select Id,Nome,Email,Telefone from Cliente"
, and not with the other columns.
I don’t see it as having any gain, but I will still answer.
– Leonel Sanches da Silva