我应该如何提取以下连接字符串并将其应用于我的Linq上下文?我知道Linq部分,但是System.Configuration部分很弱。
<connectionStrings>
<!-- Production
<add name="Management_Report_Emailer.Properties.Settings.DWConnectionString"
connectionString="Data Source=prodSQL01;Initial Catalog=DW;Integrated Security=True"
providerName="System.Data.SqlClient" />-->
<!-- QA-->
<add name="Management_Report_Emailer.Properties.Settings.DWConnectionString"
connectionString="Data Source=qaSQL01;Initial Catalog=DW;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
答案 0 :(得分:2)
ConfigurationManager.ConnectionStrings("Management_Report_Emailer.Properties.Settings.DWConnectionString").ConnectionString
答案 1 :(得分:0)
ConfigurationManager.ConnectionStrings["Management_Report_Emailer.Properties.Settings.DWConnectionString"].ConnectionString;