[英]Change property ConnectionString at runtime
is there any way to change the ConnectionString
property that has application as scope at runtime?有没有办法在运行时更改应用程序为 scope 的
ConnectionString
属性?
In this link you can use an connection string for each request.在此链接中,您可以为每个请求使用连接字符串。 Just Change the
IUserService
to IConnectionStringService
只需将
IUserService
更改为IConnectionStringService
public interface IConnectionStringService
{
string GetConnectionString();
}
public class ConnectionStringService : IConnectionStringService
{
public string GetConnectionString()
{
//read connection string from appSetting.json or anything
return "";
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.