I am new to **ASP.NET Core RC2** and I was wondering how can I get some configuration settings and apply it to my method. For Instance in my `appsettings.json`I have this specific setting

```
"ConnectionStrings": {
    "DefaultConnection": 
        "Server=localhost;User Id=postgres;port=5432;Password=castro666;Database=dbname;"
  }

```

In my Controller every time I want to query the database I have to use this setup

```
 using (var conn = 
     new NpgsqlConnection(
         "Server=localhost;User Id=postgres;port=5432;Password=castro666;Database=dbname;"))
 {
     conn.Open();
 }

```

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 `DefaultConnection` in the `appsettings.json` so that I can do something like this

```
 using (var conn = 
     new NpgsqlConnection(
         ConfigurationManager["DefaultConnection"))
 {
     conn.Open();
 }

```