KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am sure that I am somewhat lost in this area... my understanding is that Dependency Injection means initializing something that is required by a class..so for instance. If my controller is going to need a service and I want to be able to test it then I should define two Constructor methods for it... so, my question is... why do people use Frameworks to achieve this?? Im lost public class CompaniesController : Controller { private ICompaniesService _service; public CompaniesController() { _service = new CompaniesService(); } public CompaniesController(ICompaniesService service) { _service = service; }
Tags (comma-separated)
Save Edits
Cancel