Introduction
In the previous post we transformed the CustomersApi application a little bit. We added a customer repository and a customer service. We also transformed the Get action method of CustomersController into an asynchronous one.
We ended up having to construct the dependencies of CustomersController in the constructor like this:
public CustomersController()
{
_customerService = new CustomerService(new CustomerRepository());
}
In this post we’ll get rid of this direct control over the controller dependencies. Instead, we’ll let an ICustomerService object be injected into the controller through its constructor.
Read more of this post
Like this:
Like Loading...