Комментарии:
gracias!
ОтветитьI was worried that you weren't going to show how to do this from a separate project, but you did! Thank you so much!!
ОтветитьI tried Both the approach in REST API (.NetCore 3.1,VS 2019),First One is Not working where as the second Approach is working fine. Thanks...
Ответитьis't it simple?
Ответитьpublic Value(IOptions<MyOptions> option){
this.conn = option.Value.ConnString;
}
public class MyOptions
{
public string ConnString { get; set; }
}
services.AddOptions();
services.Configure<MyOptions>(mOptions=>{
mOptions.ConnString = Configuration.GetConnectionString("appString");
mOptions.pgString = Configuration.GetConnectionString("pgString");
});
thanks
ОтветитьMissing the .net days, where it'd take 10 secs to accomplish this.
Ответить