title: How to read configuration values from AppSettings and inject the configuration to instances of interface
body: <p>Just recently, I have been trying out the new asp.net features and came across this issue. 
  I know that we can read the configuration as strongly typed instance. but i have no idea how can i inject the configuration to my class in Microsoft dependency injection.</p>
  
  <pre><code>public interface IProvider
  {
    IMyConfiguration Configuration {get;}
    Task Connect();
  }
  
  public abstract class Provider: IProvider
  {
      private IMyConfiguration _myConfig;
  
      public Provider(IMyConfiguration config)
      {
          this._myConfig= config;
      }
  
      public IMyConfiguration Configuration =&gt; _myConfig;
      public abstract Task Connect();
  }
  
  public class ProviderOne:Provider
  {
      public ProviderOne(IMyConfiguration  config) : base(config)
      {
      }
  
      public Task Connect()
      {
        //implementation
      }
  }
  </code></pre>
  
  <p>configuration class:</p>
  
  <pre><code>public interface IMyConfiguration
  {
       string TerminalId { get;set; }
       bool IsDefault {get;set;}
  }
  public class MyConfiguration : IMyConfiguration
  {
       string TerminalId { get;set; }
       bool IsDefault {get;set;}
  }
  </code></pre>
  
  <p>and then in startup.cs as i declared, it is required to pass the MyConfiguration. but i could not find a way to do so. please advice!</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
    services.Configure&lt;MyConfiguration&gt;(Configuration.GetSection("MyConfiguration"));
    services.AddSingleton&lt;IProvider&gt;(new ProviderOne(//configuration)); //here is the problem
  }
  </code></pre>