title: multiple configuration databases for IdentityServer4
body: <p>Iam using an identityServer4 with multiple Databases. I could so far use muliple databases with the user-store. I solve it as the follwoing code of a middleware:</p>
  <pre><code>    public async Task Invoke(HttpContext context)
    {
       var req = context.Request;
  
       if (req.Path == &quot;/Account/Login&quot; &amp;&amp; req.Method.Equals(&quot;POST&quot;))
       {
          if (req.Form.Keys.Contains(&quot;Input.Database&quot;) == false)
          {
             throw new InvalidOperationException(&quot;No database key was sent with this request: &quot; + req.Path);
          }
          var lDatabasKey = req.Form[&quot;Input.Database&quot;];
          _configuration[&quot;ConnectionStrings:default&quot;] = _configuration[$&quot;ConnectionStrings:{lDatabasKey}&quot;];
  
       }
  </code></pre>
  <p>the configuration Object get updated, so the value ConnectionString:default get updated with the connectionstring i need to use.</p>
  <p>This concept unfortunatley not working the the configuration database, which inistalised in the ConfigureServices in Startup.cs:</p>
  <pre><code>  string connectionString = Configuration.GetConnectionString(&quot;default&quot;);
    services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;(options =&gt;
       {
          options.SignIn.RequireConfirmedEmail = false;
       })
       .AddEntityFrameworkStores&lt;IdentityUserDbContext&gt;()
       .AddDefaultTokenProviders().AddClaimsPrincipalFactory&lt;CentralHubClaimsPrincipalFactory&gt;();
  
  
       var builder = services.AddIdentityServer(options =&gt;
       {
          options.Events.RaiseErrorEvents = true;
          options.Events.RaiseInformationEvents = true;
          options.Events.RaiseFailureEvents = true;
          options.Events.RaiseSuccessEvents = true;
          options.UserInteraction.LoginUrl = &quot;/Account/Login&quot;;
          options.UserInteraction.LogoutUrl = &quot;/Account/Logout&quot;;
  
  
          options.Authentication = new AuthenticationOptions()
          {
             CookieLifetime = TimeSpan.FromHours(10), // ID server cookie timeout set to 10 hours
             CookieSlidingExpiration = true
  
          };
       })
       .AddConfigurationStore(options =&gt;
       {
          options.ConfigureDbContext = b =&gt; b.UseSqlServer(connectionString, sql =&gt; sql.MigrationsAssembly(migrationsAssembly));
       })
       .AddOperationalStore(options =&gt;
       {
          options.ConfigureDbContext = b =&gt; b.UseSqlServer(connectionString, sql =&gt; sql.MigrationsAssembly(migrationsAssembly));
  
       }).AddAspNetIdentity&lt;ApplicationUser&gt;()
       .AddProfileService&lt;AspNetIdentityProfileService&gt;();
  </code></pre>
  <p>using breaking point i can see that the connectionString:default in the middleware has correct value of the database i want to use. but it still uses the default connectionString which has been saved in the previous method in startup.cs.</p>
  <p>So is it possible to use multiple configuration databases for the identityServer?</p>