title: Asp.Net core how can I replace the Configuration Manager
body: <p>I am new to <strong>ASP.NET Core RC2</strong> and I was wondering how can I get some configuration settings and apply it to my method. For Instance in my <code>appsettings.json</code>I have this specific setting</p>
  
  <pre><code>"ConnectionStrings": {
      "DefaultConnection": 
          "Server=localhost;User Id=postgres;port=5432;Password=castro666;Database=dbname;"
    }
  </code></pre>
  
  <p>In my Controller every time I want to query the database I have to use this setup</p>
  
  <pre><code> using (var conn = 
       new NpgsqlConnection(
           "Server=localhost;User Id=postgres;port=5432;Password=castro666;Database=dbname;"))
   {
       conn.Open();
   }
  </code></pre>
  
  <p>The obvious pitfull here is that if I want to add more to the configuration I have to change every single instance of that method. My question is how can I get the <code>DefaultConnection</code> in the <code>appsettings.json</code> so that I can do something like this</p>
  
  <pre><code> using (var conn = 
       new NpgsqlConnection(
           ConfigurationManager["DefaultConnection"))
   {
       conn.Open();
   }
  </code></pre>