title: How to inject specific interface implementation using DI in ASP NET Core
body: <p>I have the following problem. I have an interface that is implemented by 2 classes. One of these classes does the real work while the other uses the first one mentioned.
  How can I tell the framework to use a specific implementation of an interface when instantiating a type of object?
  I want the controller to get the facade implementation and not the real one:</p>
  <pre><code>public interface IDependency
  {
     void Method();
  }
  
  public class Real : IDependency
  {
     public void Method()
     {
     }
  }
  
  public class Facade : IDependency
  {
     private IDependency dependency;
     Facade(IDependency dependency)  //I want a Real here
     {
       this.dependency=dependency;
     }
     public void Method()=&gt;dependency.Method();
  }
  
  
  public MyController : Controller
  {
     private IDependency dependency;
     MyController(IDependency dependency)   //I want the `Facade` here not the `Real`
     {
        this.dependency=dependency;
     }
     
     [HttpGet]
     [Route(&quot;[some route]&quot;)]
     public async Task CallMethod()
     {
        await this.dependency.Method();
     }
  
  }
  </code></pre>
  <p>As you can see in the above example, I need a <code>Real</code> type of <code>IDependency</code> injected inside my <code>Facade</code> one, while I need a <code>Facade</code> type of <code>IDependency</code> injected in my <code>MyController</code>.
  How could that be done?</p>