Config.json - Adding database connection strings in ASP.NET vNext

I am involved in the learning process of ASP.NET vNext. I need to save two connection strings in config.json file. How to store them? Can i do this:

config.json

{ "connectionStrings" : { "connection-1" : "server=...", "connection-2" : "server=..." } } 

I could not find the schema for config.json . For this reason, I was not sure how to do this. I have seen using IConfiguration here . However, I was not sure how Configuration is available in the application.

+7
c # asp.net-core
source share
2 answers

This is the official configuration repo and, this is a great blog post explaining the configuration system.

In short:

+6
source share

Here's how you can do it:

  { "Data": { "connection-1": { "ConnectionString": "Server=..." }, "connection-2": { "ConnectionString": "Server=..." } } } 
+2
source share

All Articles