【发布时间】:2017-10-24 17:15:33
【问题描述】:
我收到了几个托管在 Azure 云中的 ASP.NET 项目:
AzureCommon——基于EntityFramework的sql代码,
AzureDashboard - 网站的服务器代码。
每个项目都有 app.config (web.config) 文件并定义了它自己的 sql 连接设置。运行代码时使用了哪些连接设置?是否在生产代码中使用 localdb?
AzureCommon App.config:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
AzureDashboard web.config:
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxx" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="MyDashboardConnection" connectionString="Server=tcp:xxxxxxx.database.windows.net,1433;Initial Catalog=MyDashboard;Persist Security Info=False;User ID=Myadmin;Password=xxxxxxx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
</connectionStrings>
...
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
【问题讨论】:
标签: c# sql database-connection