title: Registering Child IOptions in ASP.NET Core
body: <p>I have the following configuration setup:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
      services.Configure&lt;AppSettings&gt;(configuration);
  }
  
  public class AppSettings
  {
      public ChildSettings Child { get; set; }
  
      public string Property { get; set; }
  }
  
  public class ChildSettings
  {
      public string ChildProperty { get; set; }
  }
  </code></pre>
  
  <p>My appSettings.json looks like this:</p>
  
  <pre><code>{
      "Child": {
          "ChildProperty": "Value"
      }
      "Property": "Value"
  }
  </code></pre>
  
  <p>I can inject <code>IOptions&lt;AppSettings&gt;</code> into my controllers just fine:</p>
  
  <pre><code>public class MyController : Controller
  {
      public MyController(IOptions&lt;AppSettings&gt; options)
      {
          ChildSettings appSettings = options.Value;
      }
  }
  </code></pre>
  
  <p>It get's a little old having to go down a few levels to get to the settings object you want. Is there a way I can use <code>IOptions&lt;ChildSettings&gt;</code> like so:</p>
  
  <pre><code>public class MyController : Controller
  {
      public MyController(IOptions&lt;ChildSettings&gt; options)
      {
          ChildSettings appSettings = options.Value;
      }
  }
  </code></pre>