title: Initialize object from Initialized object by DI in ASP.NET Core
body: <p>I have common DI usage in my ASP.NET Core application.</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {  
       services.AddScoped(sp =&gt; new UserContext(new DbContextOptionsBuilder().UseNpgsql(configuration["User"]).Options));
       services.AddScoped(sp =&gt; new ConfigContext(new DbContextOptionsBuilder().UseNpgsql(configuration["Config"]).Options));         
  }
  </code></pre>
  
  <p>In <code>ConfigContext</code> exists method <code>GetUserString</code> which returns <code>connectionString</code> to <code>UserContext</code>.
  And I need <code>AddScoped UserContext</code> with <code>connectionString</code> from <code>ConfigContext</code>
  when applying to <code>UserContext</code>.</p>