I would like to read appsettings file, but I have problem when one property is defined as IDictionary: the values are converted as string.
For example I have in appsettings defined:
"Queue":{
"Name": "Test1",
"Durable": true,
"Exclusive": false,
"AutoDelete": false,
"Arguments": {
"x-expires": 10000,
"x-overflow": "drop-head",
}
},
The class for binding is defined as
public class QueueSettings
{
public string Name { get; set; } = "";
public bool Durable { get; set; } = true;
public bool Exclusive { get; set; } = false;
public bool AutoDelete { get; set; } = false;
public IDictionary<string, object> Arguments{ get; set; }
}
and the binding is done as
QueueSettings queueSettings = new QueueSettings();
settings.GetSection("Queue").Bind(queueSettings);
In this example queueSettings.Arguments["x-expires"] is string ("10000"), but I'd like it as integer. How can I set JsonConverter in Net Core services collection? I understand that it does not use NewtonJson so JsonConverter attribute does not help.