我在web.config中有两个连接,基本上它们调用的是同一个数据库。我想以更好的方式管理它,因为在一个配置中的更改也需要更改第二个连接字符串。将连接字符串调用到web.config中的另一个连接字符串中
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;persist security info=True;user id=test;password=test123;database=db-AUTH" providerName="System.Data.SqlClient" />
<add name="dbEntities" connectionString="metadata=res://*/InsuranceFinderModel.csdl|res://*/InsuranceFinderModel.ssdl|res://*/InsuranceFinderModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=db-AUTH;persist security info=True;user id=test;password=test123;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
我的问题是,有什么办法,我可以调用连接字符串到其他连接字符串。
例如。默认连接字符串数据库实体像
<add name="dbEntities" connectionString="metadata=res://*/InsuranceFinderModel.csdl|res://*/InsuranceFinderModel.ssdl|res://*/InsuranceFinderModel.msl;provider=System.Data.SqlClient;provider connection string= DefaultConnection" providerName="System.Data.EntityClient" />
任何意见,将不胜感激谢谢。
仅供参考:http://stackoverflow.com/questions/6443060/is-it-possible-to-reference-a-connection-string-in-another-connection-string – ACOMIT001