title: ASP.NET CORE: Change connectionString through WEBAPI
body: <p>I have declared connection string in appsetting.json file. I would like to change the connection string through web api call. </p>
  
  <p>Is there a way to do it?</p>
  
  <p>I am working with ASP.Net Core. </p>
  
  <p>appsettings.json:</p>
  
  <pre><code>  "Database": {
      "ProviderName": "MySQL",
      "ConnectionString": "server=localhost;database=sampledb;uid=user;pwd=user"
    },
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>  var builder = new ConfigurationBuilder()
          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);  
  
    //Accessing Database section from appsettings.json
    services.Configure&lt;dbSettings&gt;(StaticSettings.GetSection("Database"));
  </code></pre>