I have an appsettings.json file which looks like this:
{
\"someSetting\": {
\"subSettings\": [
\"one\",
\"two\",
In my case configuration
services.Configure>(Configuration.GetSection("ApiKeysList"));
wasn't loaded because the properties were read-only and there were no default constructor
**//not working**
public class ApiKey : IApiKey
{
public ApiKey(string key, string owner)
{
Key = key;
OwnerName = owner;
}
public string Key { get; }
public string OwnerName { get;}
}
//Working
public class ApiKey : IApiKey
{
public ApiKey(){}//Added default constructor
public ApiKey(string key, string owner)
{
Key = key;
OwnerName = owner;
}
public string Key { get; set; } //Added set property
public string OwnerName { get; set; } //Added set property
}