title: .net core generic host builder use connection string from one context in a subsequent context DI registration
body: <p>I need to register two <code>DbContext</code> classes in my .net core 2.1 application using the built in Ioc container. The connection details for the second context is stored in the database from the first context, so the registrations would look something like</p>
  
  <pre><code>new HostBuilder()
      .ConfigureServices((hostContext, services) =&gt;
      {
          services
          .AddDbContext&lt;Context1&gt;()
          .AddDbContext&lt;Context2&gt;( /* Connection string from context1 here */ )
          .AddHostedService&lt;MyHostedService&gt;();
      });
  </code></pre>
  
  <p>Is there any way for me to register <code>Context1</code>, get the values and then use that to register <code>Context2</code>?</p>