我正在尝试为遗留项目设置持续集成。在 Web.config 中,有实体框架连接字符串:
<add name="StuffContext"
connectionString="
metadata=res://*/Stuff.csdl|res://*/Stuff.ssdl|res://*/Stuff.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=mydbserver;
initial catalog=mydb;
persist security info=True;
user id=loki2302;
password=qwerty;
multipleactiveresultsets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
有没有办法以某种方式提取provider connection string
并在StuffContext
连接字符串中按名称引用它?试图实现这样的目标:
...
<add name="StuffContext"
connectionString="metadata=...;name=StuffDb" />
<add name="StuffDb"
connectionString="
data source=mydbserver;
initial catalog=mydb;
persist security info=True;
user id=loki2302;
password=qwerty;
multipleactiveresultsets=True;
App=EntityFramework" />
...