2
I have my class Service
calling for GrupoService
, in it are most of the shares that refer to a Grupo
.
Crud(Inserir,Alterar,Excluir,Listar)
The only dependency I have in my class so far is the GrupoRepository
. Also got into it, methods, to insert, change,delete, delete.
So basically I do
public Grupo Inserir(Grupo model)
{
return grupoRepository.Inserir(model);
}
But my group contains Itens
, what is the correct way to inject the Item
in my class GrupoService
?
Injecting the ItemRepository
along with GrupoRepository
, or I put ItemService
?
If you are working with the Entity Framework, the best way is to put it in
model.Itens
, because the Entity Framework solves this at the consistency level. By separating too much you are creating a complicator and subusing the tool.– Leonel Sanches da Silva