【发布时间】:2019-03-14 20:04:23
【问题描述】:
为什么这段代码会出现在我的 web.config 文件中?我创建 ADO.NET 实体数据模型时它不存在,那么是什么事件触发了此代码的生成?
<configSections>
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false"/>
</configSections>
<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>
【问题讨论】:
-
你添加了 EF nuget 包吗?
-
是的,当我创建 ADO.NET 实体数据模型时,它会通过 NuGet @Will 自动下载并安装 EntityFramework
-
那就这样吧。
-
是的,我刚刚在此处docs.microsoft.com/en-us/ef/ef6/fundamentals/configuring/… 的 Microsoft EntityFramework 指南中读到了这一点,奇怪的是我有另一个项目安装了 EF6,但它没有将这些标签放在 web.config 文件中。这就是我感到困惑的原因。
标签: asp.net asp.net-mvc entity-framework web-config