【发布时间】:2018-11-20 23:29:51
【问题描述】:
我在配置文件中有以下键,我想从配置文件中动态地将“添加键”传递给我的 conn 变量,我可以传入 qp.cat.qmgr 成功,在我的 conn 变量中,我想知道如何将其他键传递给我的变量我是否从 .config 中传递下一个键,例如 +“qp.cat.quser”,即
var conn = new RabbitMqConnection(Helpers.AppSettings.Get<string>("qp.cat.qmgr") + ("qp.cat.quser") + ("qp.cat.qpassword"));
var conn = new RabbitMqConnection(Helpers.AppSettings.Get<string>("qp.cat.qmgr"), "theTestingUAT", "catquat"); //this works but "theTestingUAT" and "catquat" is hard coded, dont want them to be hardcoded
<add key="qp.cat.qmgr" value="thetest:5444" />
<add key="qp.cat.quser" value="theTestingUAT" />
<add key="qp.cat.qpassword" value="catquat" />
请指教。
【问题讨论】:
标签: c# model-view-controller key app-config