2
I’m trying to implement the recording of my views, Usuario
repository in my controller, even using dependency injection examples, because in my user’s repository constructor it expects to receive an interface from my context.
How can I do in mine controller to access the methods add
, savechanges
and etc.
My user Repository:
RepositoryBase<Usuario>, IUsuarioRepository
{
public UsuarioRepository(ILetsPartyContext context)
: base(context)
{
}
}
How I tried to implement but it didn’t work.
public ILetsPartyContext _Context;
public UsuarioController(ILetsPartyContext Context)
{
_Context = Context;
}
UsuarioRepository rep = new UsuarioRepository(_Context);
Felipe, in this case I am having doubts about the correct way to inject a depended in my controller so that I can use the insertion methods of my user repositorio and use the savechanges of my context.
– Rafael Damasio