3
What is the best way to recover data from a direct table to a Datagridview ?
I have several doubts, because, many people do not recommend using Unitofwork which makes it much easier and leaves the code much cleaner.
var unitOfWork = new UnitOfWork(new DBConecta());
var _registros = unitOfWork.RepoPaises.Get();
BindingListView<CNAES> _DataView = new BindingListView<CNAES>(_registros);
dbGride.DataSource = _DataView;
After seeing here in the forum people saying that it does not make sense to use Uow, since the Entity Framework is already the access layer, I went back to the normal mode, but I’m finding it very strange
_context = new DBConecta();
var registros = _context.CNAES.
Select(c => new
{
id = c.id,
nome = c.nome,
ativo = c.ativo,
usuarioNome = c.usuario.primeiro_nome + " " + c.usuario.segundo_nome,
created_at = c.created_at,
updated_at = c.updated_at,
usuario_id = c.usuario_id
}).ToList();
this.dbGride.DataSource = registros;
AfterRetrieve();
_context.Dispose();
As I have never worked in . NET teams do not know what the best practices, I would like an orientation. Thank you.
With this amount of data the best way is the Entity Framework.
– Marco Souza