Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How can I get configuration information from the appsettings file

$
0
0

I am new to Asp.net rc2 and was wondering how can I get the information from the Appsettings Json, for example in the appsettings.Json we have this file

{"ConnectionStrings": {"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplication1-3d6667bc-4e99-48f8-80e7-302a1c013e99;Trusted_Connection=True;MultipleActiveResultSets=true"
  },"Logging": {"IncludeScopes": false,"LogLevel": {"Default": "Debug","System": "Information","Microsoft": "Information"
    }
  }
}

How can I get DefaultConnection settings so that I can embed it in my program. When I used MVC 5 I could do this

string strConn = ConfigurationManager.AppSettings["DefaultConnection"].ToString();

however I do know that I can not use that for RC2 any suggestions would be great.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>