title: usage of service layer classes as composition rather than inheritance
body: <p>I have been to told <a href="https://stackoverflow.com/questions/24379969/asp-net-mvc-layered-application-am-i-understanding-it-right">here</a> that I should separate my <code>Service</code> class and <code>Repository</code> class, so I did. And below is an example.</p>
  
  <pre><code>public class ProductService
  {
      private readonly IProductRepository productRepository;
  
      public ProductService(IProductRepository productRepository)
      {
          this.productRepository = productRepository;
      }
  
      public IEnumerable&lt;Product&gt; GetCurrentProductsOnOrderForCustomer(int customerId)
      {
          // etc.
      }
  }
  </code></pre>
  
  <p>But how do I use this in my <code>Controller</code>? How I use it is like this:</p>
  
  <pre><code>public class ProductController : Controller
  {
    ProductService prodService = new ProductService();
  }
  </code></pre>
  
  <p>But I've read that should implement abstraction. Should I make another class called <code>IProductService</code> and use it like this?</p>
  
  <pre><code>public class ProductController : Controller
  {
    private readonly IProductService  _productService;
    private readonly IUnitOfWork _uow;
  
    public ProductController(IProductService  productService, IUnitOfWork uow)
    {
      _uow = uow;
      _productService = productService;
    }
  }
  </code></pre>
  
  <p>An example of <code>IProductService</code> would be great. Any help would be much appreciated. Thanks.</p>