title: Using configuration settings in nested classes
body: <p>When I have nested classes where children need some of the configuration settings (i.e., settings written in <code>appsettings.json</code>), do I need to make a bucket relay to pass configuration to children classes?</p>
  
  <p>I don't think the example below is a smart way. Is there any better practice?</p>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre><code>public Startup(IConfiguration configuration, ...)
      {
          ...
          this.Configuration = configuration;
          ...
      }
  </code></pre>
  
  <p><strong>Parent.cs</strong></p>
  
  <pre><code>public class Parent
  {
      public Parent(IConfiguration configuration)
      {
          _configuration = configuration;
      }
  
      private IConfiguration _configuration;
      private ChildOne _childOne;
      private ChildTwo _childTwo;
  
      public void InitializeChildren()
      {
          _childOne = new ChildOne(_configuration);
          _childTwo = new ChildTwo(_configuration);
      }
  }
  </code></pre>
  
  <p><strong>ChildOne.cs</strong></p>
  
  <pre><code>public class ChildOne{
      public ChildOne(IConfiguration configuration){
          _propOne = configuration.GetSection("brahbrah").Value;
      }
  
      private string _propOne;
  }
  </code></pre>