title: .NET Core get connection string from appsettings.json
body: <p>I develop a simple web app and, in the future, I want to do it as multi-tenancy.</p>
  
  <p>So I want to write the connection string straight into <code>OnConfiguring</code> method:</p>
  
  <pre><code>public class ApplicationContext : DbContext
  {
      public DbSet&lt;User&gt; Users { get; set; }
  
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseSqlServer("connection string from appsettings.json");
          base.OnConfiguring(optionsBuilder);
      }
  }
  </code></pre>
  
  <p>Startup class:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddDbContext&lt;ApplicationContext&gt;();
      services.AddMvc();
  }
  </code></pre>
  
  <p>How can I extract connection string from <code>appsettings.json</code> into <code>ApplicationContext</code> class?</p>
  
  <p>I wouldn't like to create any constructors for <code>ApplicationContext</code> class.</p>