title: Get instance of singleton service in startup
body: <p>I have the following situation:</p>
  
  <p><em>startup.cs</em></p>
  
  <pre><code>services.AddSingleton&lt;IConfigurationManager, ConfigurationManager&gt;();
  ConfigurationManager configurationManager = new ConfigurationManager();
  services.AddDbContext&lt;MyContext&gt;(options =&gt; 
      options.UseSqlServer(configurationManager.DatabaseConnectionString));
  </code></pre>
  
  <p>So, in order to create my context I need the connection string which this <code>configurationManager</code> provides to me. However, I would still like to keep the <code>ConfigurationManager</code> as a service. </p>
  
  <p>Is there a way to do this without explicitly instantiating the <code>configurationManager</code> or is it perhaps even fine to leave it like this?</p>