title: How do you access the configuration parameters needed for a configuration provider?
body: <p>This code is usual in the startup of many .netCore apps:</p>
  <pre><code>        var builder = new ConfigurationBuilder()
              .AddJsonFile(&quot;local.settings.json&quot;, optional: true, reloadOnChange: true)
              .AddEnvironmentVariables();
  
          var configuration = builder.Build();
  </code></pre>
  <p>You can add any additional provider to the builder object, but you'll be able to access the configuration values only after you call builder.Build()</p>
  <p>I would like to know what is a good approach when one of the providers requires parameters that needs to be read from the configuration. For example:</p>
  <pre><code>        var builder = new ConfigurationBuilder()
              .AddJsonFile(&quot;local.settings.json&quot;, optional: true, reloadOnChange: true)
              .AddCustomProvider(&quot;value1&quot;, &quot;value2&quot;)  //THIS
              .AddEnvironmentVariables();
  
          var configuration = builder.Build();
  </code></pre>
  <p>As you can see, would be nice to get &quot;value1&quot;, &quot;value2&quot; from config, but we need first to build the configuration.</p>
  <p>A possible way could be to load the configuration values in 2 steps:</p>
  <pre><code>        //Step 1
          var tempBuilder = new ConfigurationBuilder()
              .AddJsonFile(&quot;local.settings.json&quot;, optional: true, reloadOnChange: true)
              .AddEnvironmentVariables();
  
          var tempConfiguration = tempBuilder.Build();
  
          //Step 2
          var finalBuilder = new ConfigurationBuilder()
              .AddConfiguration(tempConfiguration)
              .AddCustomProvider(tempConfiguration[&quot;key1&quot;], tempConfiguration[&quot;key2&quot;]);
  
          var finalConfiguration = finalBuilder.Build();
  </code></pre>
  <p>Seems acceptable, but would like if I'm applying something that is not needed at all, some anti-pattern or there is a better approach</p>