title: Web API, Light Inject and Passing a Static Dictionary to the data layer
body: <p>We have a multi-database solution and are passing the connection string to a factory function like so:</p>
  
  <pre><code>container.Register&lt;IDbContextFactory&gt;(
      f =&gt; new DynamicDbContextFactory(ClientConfig.GetConnectionString()),
      new PerScopeLifetime());
  </code></pre>
  
  <p><code>ClientConfig</code> contains a static dictionary that gets populated on app start that maps a sub domain to a connection string.  It seems that this approach is causing a memory leak (not 100% sure about this causing the leak but there is a leak).</p>
  
  <pre><code>public class ClientConfig
  {
      private static ConcurrentDictionary&lt;string, string&gt; ConnectionStringManager 
      { 
          get;
          set; 
      }
  
      // etc.
  }
  </code></pre>
  
  <p>My question is in MVC what is the best way to hold a list of connection strings that can be easily looked up on each request in order to pass that down the chain.</p>