title: Dependency Injection with Multiple Interfaces
body: <p>I am just learning Interface Segregation Principle. But after learning i am confused with the scenario in the example.</p>
  
  <p>The concept is  separating the interfaces into simple interfaces. That is well but my question is with hierarchy model or not?</p>
  
  <p>Take the example i studied in the book.</p>
  
  <p>I have one Interface for product with the following properties</p>
  
  <pre><code>public interface IProduct
  {
  decimal Price { get; set; }
  decimal WeightInKg { get; set; }
  int Stock { get; set; }
  int Certification { get; set; }
  int RunningTime { get; set; }
  }
  </code></pre>
  
  <p>I just simplify with one class implmentation from the interface</p>
  
  <pre><code>public class DVD : IProduct
  {
  public decimal Price { get; set; }
  public decimal WeightInKg { get; set; }
  public int Stock { get; set; }
  public int Certification { get; set; }
  public int RunningTime { get; set; }
  }
  </code></pre>
  
  <p>The problem is when apply to the other categories which have not related properties. When create a class for TShirt, there is no needed for Certification and RunningTime. So as per the Interface Segregation Principle, the interface is separated like below</p>
  
  <p>Create a new interface, move the movie related properties to this one like below</p>
  
  <pre><code>public interface IMovie
  {
  int Certification { get; set; }
  int RunningTime { get; set; }
  }
  </code></pre>
  
  <p>So the IProduct does not have these properties and the implementation like below</p>
  
  <pre><code>public class TShirt : IProduct
  {
  public decimal Price { get; set; }
  public decimal WeightInKg { get; set; }
  public int Stock { get; set; }
  }
  
  public class DVD : IProduct, IMovie
  {
  public decimal Price { get; set; }
  public decimal WeightInKg { get; set; }
  public int Stock { get; set; }
  public int Certification { get; set; }
  public int RunningTime { get; set; }
  }
  </code></pre>
  
  <p>Conceptionally i am ok with this.  But if this about real method implementation like this. When i use dependency injection which interface i used as the type for DVD class.</p>
  
  <p>I am confused or i missing something ? If i apply the inheritance logic we can use the lower level interface so base interface also inherited. But if i use like this how can implement?</p>