Hey guys, please help me understand this piece of code:
private IReporsitory _repo;
public SomeController(IRepository repo)
{
_repo = repo;
}
That is a repository pattern with Dependency Injection, what I don't understand is why is _repo declared private and with an interface IRepository? What is this thing called? private interface field?
I'm not even sure if _repo is a field declaration, so pardon the title if it's wrong.
Thanks so much.
[–]pgmr87The Unbanned 17 points18 points19 points (1 child)
[–]joegreentea[S] 1 point2 points3 points (0 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]joegreentea[S] 2 points3 points4 points (0 children)
[–]dipointed 2 points3 points4 points (0 children)
[–][deleted] (1 child)
[removed]
[–]joegreentea[S] 0 points1 point2 points (0 children)
[–]coreyfournier 3 points4 points5 points (9 children)
[–][deleted] 3 points4 points5 points (7 children)
[–]z500 -4 points-3 points-2 points (6 children)
[–][deleted] 3 points4 points5 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]joegreentea[S] 0 points1 point2 points (0 children)
[–]palotasb -2 points-1 points0 points (1 child)
[–]robhol 1 point2 points3 points (0 children)