title: How to get connection string from app.config or appsettings.json in OnConfiguring method
body: <p>I have class that inherits from dbcontext class and that class is named CustomNorthwindContext.
  I can take connection string from appsettings.json when I use constructor below .</p>
  <pre><code>public CustomNorthwindContext(DbContextOptions&lt;CustomNorthwindContext&gt; options) : base(options){ }
  </code></pre>
  <p>After that I use code block below in configureservices and I am able to make the connection successfully.</p>
  <pre><code> services.AddDbContext&lt;CustomNorthwindContext&gt;(options =&gt;
              {
                 options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnectionString&quot;)
                  , sqlOptions =&gt;
                  {
                      sqlOptions.MigrationsAssembly(&quot;Northwind.DataAccess&quot;);
                  });
  
              });
  </code></pre>
  <p>Is there any simple way how can I get the connections string stored in appsettings.json or app.config in .net core in <code>OnConfiguring</code> method?</p>
  <pre><code> public class CustomNorthwindContext: DbContext
      {
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          {
              optionsBuilder.UseSqlServer(&quot;MyConnectionStringFromAppConfig&quot;);
              base.OnConfiguring(optionsBuilder);
          }
  
          public DbSet&lt;Product&gt; Products { get; set; }
  
          protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly);
              base.OnModelCreating(modelBuilder);
          }
      }
  
  </code></pre>