I am trying to learn ASP.NET 5. I am using it on Mac OS X. At this time, I have a config.json file that looks like the following:
config.json
Try use OptionsModel
. it allows strong typed model binding to configuration.
class AppSettings
{
public string SomeSetting {get;set;}
}
var configuration = new Configuration().AddJsonFile("config.json");
var opt = ConfigurationBinder.Bind(configuration);
opt.SomeSetting
Example: https://github.com/aspnet/Options/blob/dev/test/Microsoft.Framework.OptionsModel.Test/OptionsTest.cs#L80