.net mvc3 三层架构的数据库连接问题 源代码

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/GUO_LOVER/article/details/52152652
//.net MVC3 连接数据库代码  web.config文件   eg:JX
<connectionStrings>
  <add name="JXEntities" connectionString="metadata=res://*/Models.JXDB.csdl|res://*/Models.JXDB.ssdl|res://*/Models.JXDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=JX;user id=sa;password=123456;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

//AMS
<connectionStrings>
  <!--<add name="AMS_DMS_ProdEntities_Production" connectionString="metadata=res://*/DAL.AMSEntitiesProduction.csdl|res://*/DAL.AMSEntitiesProduction.ssdl|res://*/DAL.AMSEntitiesProduction.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=64.78.59.214;initial catalog=AMS_DMS_Prod;persist security info=True;user id=AMS_Developer;password=g1lbert;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  <add name="AMS_DMS_ProdConnectionString" connectionString="Data Source=64.78.59.214;Initial Catalog=AMS_DMS_Prod;Persist Security Info=True;User ID=AMS_Developer;Password=g1lbert;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" />-->
  <add name="AMS_DMS_ProdConnectionString" connectionString="Data Source=.;Initial Catalog=AMS_DMS_Prod;Persist Security Info=True;User ID=sa;Password=123456;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" />
  <add name="AMS_DMS_ProdEntities_Production" connectionString="metadata=res://*/DAL.AMS_DMS_ProdEntities_Production.csdl|res://*/DAL.AMS_DMS_ProdEntities_Production.ssdl|res://*/DAL.AMS_DMS_ProdEntities_Production.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=AMS_DMS_Prod;User ID=sa;Password=123456;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  <add name="MySqlConnectionString" connectionString="server=143.95.249.235;user id=pacstat1_admin;password=P@c$tats;database=pacstat1_community; pooling=false" />
  </connectionStrings>

//三层架构下数据库配置在界面层的web.config    eg:LG
  <connectionStrings>
<!--Production Database-->
  <add name="LogicsConnect" connectionString="Server=.;DATABASE=LeadGeneration1;UID=sa;PWD=123456" providerName="System.Data.SqlClient"/>

<!--Test Database-->
<add name="LogicsConnectTest" connectionString="Server=.;DATABASE=LeadGeneration;UID=sa;PWD=123456" providerName="System.Data.SqlClient"/>
  </connectionStrings>
展开阅读全文

没有更多推荐了,返回首页