Access Configuration/Settings on static class - Asp Core : <p>I have 3 solutions. Project.Web, Project.Core (Business), and Project.Layer(Models). </p>

<p>In Project.Core, I have a static file that I can call like this <code>Business.GetAllData();</code> from Project.Web.Controller.</p>

<p>This calls DAL/EF files and gets data(<code>BusinessDal.GetData()</code>). </p>

<pre><code>        using (DBContext db = new DBContext())
        {
            return db.GetAllData().ToPOCO();
        }
</code></pre>

<p>On my configuration/DbContext.cs, I have this:</p>

<pre><code>protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    #if DEBUG
        optionsBuilder.UseSqlServer(@"connstring");
    #else
        optionsBuilder.UseSqlServer(@"connstring");
    #endif
    // How do I access configuration here? Configuration["ConnectionString"]
}
</code></pre>

<p>What I'm trying to do is read settings from my appsettings.json. I made sure settings are loaded properly on startup.cs</p>

<pre><code>public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder()
        .SetBasePath(env.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
        .AddEnvironmentVariables();
    Configuration = builder.Build();
}
</code></pre>

<p>But now what?... <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?tabs=basicconfiguration" rel="noreferrer">MS Document</a> shows how to read it from controllers. And that part works fine, I can read my settings on Controllers. However, I am not sure how to pass it to another project and still be able to call it from a static class. </p>
